generated from krampus/template-godot4
17 lines
397 B
GDScript3
17 lines
397 B
GDScript3
|
extends GameBall
|
||
|
## The plasma ball sticks to the first surface it hits
|
||
|
|
||
|
@onready var manual_sleep_timer: Timer = %ManualSleepTimer
|
||
|
|
||
|
|
||
|
func _on_body_entered(_body: Node) -> void:
|
||
|
print_debug("Plasma ball stuck to ", _body)
|
||
|
# Freeze physics as soon as we hit something
|
||
|
freeze = true
|
||
|
sleeping = true
|
||
|
manual_sleep_timer.start()
|
||
|
|
||
|
|
||
|
func _fire_sleep_signal() -> void:
|
||
|
sleeping_state_changed.emit()
|