ft: player attacking logic

This commit is contained in:
2026-01-17 14:20:54 +01:00
parent 5811658c64
commit 18ce1716e4
8 changed files with 92 additions and 61 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=3 uid="uid://dxluckxdkpv4f"]
[gd_scene load_steps=6 format=3 uid="uid://dxluckxdkpv4f"]
[ext_resource type="Script" uid="uid://di7eglnrnqm6i" path="res://molecular/molecular_player.gd" id="1_0ix7k"]
[ext_resource type="Texture2D" uid="uid://cxwvga07sm3yl" path="res://molecular/assets/player-sprite-placeholder-crop.png" id="2_en8op"]
@@ -14,6 +14,9 @@ animations = [{
"speed": 5.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_en8op"]
size = Vector2(765.4969, 706.5864)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4flbx"]
radius = 191.95984
height = 1295.8773
@@ -27,7 +30,27 @@ visibility_layer = 2
scale = Vector2(0.5, 0.5)
sprite_frames = SubResource("SpriteFrames_onrkg")
[node name="AttackArea" type="Area2D" parent="."]
position = Vector2(0, 56)
rotation = -1.5732701
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="AttackArea"]
position = Vector2(29.579561, 730.73236)
shape = SubResource("RectangleShape2D_en8op")
debug_color = Color(0.80813414, 0.3957308, 0.3356335, 0.41960785)
[node name="CollisionShape2D" type="CollisionShape2D" parent="." groups=["player"]]
position = Vector2(0, 56)
rotation = -1.5732701
shape = SubResource("CapsuleShape2D_4flbx")
[node name="AttackTimer" type="Timer" parent="."]
one_shot = true
[node name="AttackCooldownTimer" type="Timer" parent="."]
one_shot = true
[connection signal="body_entered" from="AttackArea" to="." method="_on_attack_hit"]
[connection signal="timeout" from="AttackTimer" to="." method="_on_attack_timeout"]
[connection signal="timeout" from="AttackCooldownTimer" to="." method="_on_cooldown_timeout"]