Coins system, and finished mortar

This commit is contained in:
2025-04-30 08:57:16 +02:00
parent 6ffc9d3ba9
commit 7d79d3f60f
15 changed files with 253 additions and 37 deletions

View File

@ -12,6 +12,8 @@ var midpoint = 0
var t = 0.0
var duration = 0.5
static var NAMES = ["Forkman", "Cobold", "Ork"]
func _ready() -> void:
starterpos = global_position
targetpos = target.global_position
@ -34,6 +36,12 @@ func _process(delta: float) -> void:
position = bezier(t)
if t >= 1.0:
get_node("CharacterBody2D/AnimatedSprite2D").play("hit")
var killalll = get_node("Area2D").get_overlapping_bodies()
for i in killalll:
for j in NAMES:
if i.get_parent().name.contains(j):
i.get_parent().enemy_hurt(hitpoint)
set_process(false)
elif target and speed > 0:
# Get the direction vector from the bullet to the target

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://cwcgq1vk643ha"]
[gd_scene load_steps=11 format=3 uid="uid://cwcgq1vk643ha"]
[ext_resource type="Script" uid="uid://dqvdgdobuo2rf" path="res://Game/Bullets/bullet.gd" id="1_yml18"]
[ext_resource type="Texture2D" uid="uid://t8y1d33eiffp" path="res://Assets/Bullets/mortarbullet (1).png" id="2_yml18"]
@ -42,6 +42,8 @@ animations = [{
"speed": 8.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_tjven"]
[node name="Rock" type="Node2D"]
script = ExtResource("1_yml18")
@ -56,4 +58,10 @@ scale = Vector2(0.4, 0.4)
sprite_frames = SubResource("SpriteFrames_yml18")
autoplay = "default"
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
scale = Vector2(3, 3)
shape = SubResource("CircleShape2D_tjven")
[connection signal="animation_finished" from="CharacterBody2D/AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]