mirror of
https://github.com/DerTyp7/TopDownShooter-Godot.git
synced 2025-10-29 12:52:13 +01:00
Add enemies and let them be shot
This commit is contained in:
14
Bullet.gd
14
Bullet.gd
@@ -5,19 +5,9 @@ var destroy_timer := Timer.new()
|
||||
func _ready():
|
||||
add_child(destroy_timer)
|
||||
destroy_timer.wait_time = 5.0
|
||||
destroy_timer.one_shot = true # Automatically stops after timing out
|
||||
|
||||
# Start the timer
|
||||
destroy_timer.one_shot = true
|
||||
destroy_timer.start()
|
||||
|
||||
# Connect the "timeout" signal
|
||||
destroy_timer.connect("timeout", _on_destroy_timer_timeout)
|
||||
|
||||
# Set the wait time for the timer (5 seconds)
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_destroy_timer_timeout():
|
||||
# This function will be called when the timer times out
|
||||
queue_free() # Destroy the object
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user