first commit

This commit is contained in:
Peter Hinton
2026-06-21 17:00:58 -06:00
commit a20cfbe748
78 changed files with 2784 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
extends Node2D
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
@onready var death_timer: Timer = $DeathTimer
@onready var collision_shape_2d: CollisionShape2D = $AnimatedSprite2D/Area2D/CollisionShape2D
signal player_died
const SPEED :int = 50
var direction :float = -1.0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
position.x += direction * SPEED * delta
func _on_area_2d_body_entered_for_death(body: Node2D) -> void:
if body.name == "player":
animated_sprite_2d.animation = "dying"
queue_free()
death_timer.start()
func _on_body_entered(body: Node2D) -> void:
if body.name == "player":
emit_signal("player_died", body)
direction *= -1
animated_sprite_2d.flip_h = !animated_sprite_2d.flip_h
func _on_death_timer_timeout() -> void:
print("Timer finished")