mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-12 21:42:23 +02:00
Added appropriate groups and checked for hitbox-likeness
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
[ext_resource path="res://Overlap/HurtHit_Box/Hitbox.gd" type="Script" id=1]
|
||||
|
||||
[node name="Hitbox" type="Area2D"]
|
||||
[node name="Hitbox" type="Area2D" groups=[
|
||||
"hitbox",
|
||||
]]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
[ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.gd" type="Script" id=1]
|
||||
|
||||
[node name="Hurtbox" type="Area2D"]
|
||||
[node name="Hurtbox" type="Area2D" groups=[
|
||||
"hurtbox",
|
||||
]]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
@@ -174,19 +174,21 @@ func roll_finished():
|
||||
|
||||
|
||||
func _on_Hurtbox_area_entered(area):
|
||||
player_stats.health -= area.damage
|
||||
|
||||
if area.damage > 0:
|
||||
damage_per_second += area.damage
|
||||
else:
|
||||
heal_per_second += abs(area.damage)
|
||||
if area.is_in_group("hitbox"):
|
||||
player_stats.health -= area.damage
|
||||
|
||||
if area.damage > 0:
|
||||
damage_per_second += area.damage
|
||||
else:
|
||||
heal_per_second += abs(area.damage)
|
||||
|
||||
|
||||
func _on_Hurtbox_area_exited(area):
|
||||
if area.damage > 0:
|
||||
damage_per_second -= area.damage
|
||||
else:
|
||||
heal_per_second -= abs(area.damage)
|
||||
if area.is_in_group("hitbox"):
|
||||
if area.damage > 0:
|
||||
damage_per_second -= area.damage
|
||||
else:
|
||||
heal_per_second -= abs(area.damage)
|
||||
|
||||
|
||||
func _on_Stats_no_health():
|
||||
|
||||
@@ -623,7 +623,10 @@ height = 6.99104
|
||||
size = 12
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
[node name="Player" type="KinematicBody2D" groups=[
|
||||
"hero",
|
||||
]]
|
||||
collision_mask = 10
|
||||
script = ExtResource( 1 )
|
||||
FRICTION = 270
|
||||
|
||||
@@ -637,7 +640,7 @@ scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 2 )
|
||||
offset = Vector2( 0, -18 )
|
||||
hframes = 60
|
||||
frame = 9
|
||||
frame = 12
|
||||
|
||||
[node name="Body" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 0.0107212, 0.0456073 )
|
||||
|
||||
Reference in New Issue
Block a user