Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sword slash removed from solid collision #55

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions scenes/projectiles/sword_slash.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[gd_scene load_steps=19 format=3 uid="uid://c6ys2qs8aeu8n"]
[gd_scene load_steps=18 format=3 uid="uid://c6ys2qs8aeu8n"]

[ext_resource type="PackedScene" uid="uid://beifde6xst23w" path="res://scenes/projectiles/projectile.tscn" id="1_lwexf"]
[ext_resource type="Texture2D" uid="uid://b3kerfdfiley3" path="res://assets/images/shadow.png" id="2_pfam2"]
[ext_resource type="PackedScene" uid="uid://djobi3eqlcjvo" path="res://scenes/vfx/trail_particle.tscn" id="3_gx0bp"]
[ext_resource type="Texture2D" uid="uid://d155og1uw717" path="res://assets/images/vfx/slash_3_strip4.png" id="4_u6vsr"]
[ext_resource type="PackedScene" uid="uid://bmmyvowwwwyu1" path="res://scenes/vfx/explosion_0.tscn" id="5_yh6pw"]
[ext_resource type="Script" path="res://scripts/weapon_system/projectile/ProjectileSpawner.gd" id="6_whjok"]
[ext_resource type="Resource" uid="uid://d1ck1axrd4kd4" path="res://resources/ReferenceNodeResources/ysort_reference.tres" id="7_d1e47"]
[ext_resource type="Script" path="res://scripts/weapon_system/projectile/SubProjectileManager.gd" id="7_n74ie"]
Expand Down Expand Up @@ -130,9 +129,6 @@ libraries = {
}
autoplay = "slash"

[node name="ProjectileImpact" parent="." index="4"]
impact_scene = ExtResource("5_yh6pw")

[node name="ProjectileSpawner" type="Node" parent="." index="5"]
script = ExtResource("6_whjok")
initial_distance = 10.0
Expand Down
2 changes: 1 addition & 1 deletion scripts/actor/MoverTopDown2D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func _physics_process(delta:float)->void:
if distance > 0.0:
ratio = min(acceleration / distance, 1.0)
character.velocity += (direction * ratio)
var collided:bool = character.move_and_slide()
var _collided:bool = character.move_and_slide()

## Adds an impulse to velocity, like a kickback
func add_impulse(impulse:Vector2)->void:
Expand Down
7 changes: 6 additions & 1 deletion scripts/weapon_system/projectile/HitLimit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ extends Node
@export var hit_limit:int = 1

func _ready()->void:
if hit_limit < 1:
return
damage_source.hit.connect(on_hit)
damage_source.hit_solid.connect(projectile.prepare_exit)
damage_source.hit_solid.connect(on_hit_solid)

func on_hit_solid()->void:
projectile.prepare_exit()

func on_hit()->void:
if hit_limit < 1:
Expand Down