add theme, player simple attack

This commit is contained in:
2025-01-05 00:25:50 +01:00
parent f537722849
commit 5b558f9c3b
10 changed files with 1662 additions and 12 deletions

View File

@@ -1,7 +1,6 @@
class_name BulletComponent
extends Node
@export var root: Node2D
@export var direction: Vector2 = Vector2.RIGHT
@export var speed: float = 10.0
@@ -10,23 +9,27 @@ extends Node
@export var life_time: float = 5.0
@export var timer: Timer
func _ready() -> void:
root = get_parent()
visibility_notifier.screen_exited.connect(_on_screen_exited)
area2d.body_entered.connect(on_area2d_body_entered)
timer.wait_time = life_time
timer.timeout.connect(on_timer_timeout)
func _physics_process(delta: float) -> void:
root.position += direction * speed * delta
func _on_screen_exited() -> void:
root.queue_free()
func on_area2d_body_entered(_body: Node2D) -> void:
root.queue_free()
func on_timer_timeout() -> void:
root.queue_free()