2024-09-11 18:19:06 +02:00
|
|
|
extends Sprite2D
|
|
|
|
|
|
|
|
var speed = 400
|
|
|
|
var angular_speed = PI
|
|
|
|
|
2024-09-11 19:03:50 +02:00
|
|
|
func _ready():
|
|
|
|
var timer = get_node("Timer")
|
|
|
|
timer.timeout.connect(_on_timer_timeout)
|
|
|
|
|
2024-09-11 18:19:06 +02:00
|
|
|
func _process(delta: float) -> void:
|
2024-09-11 19:03:50 +02:00
|
|
|
rotation += angular_speed * delta
|
|
|
|
var velocity = Vector2.UP.rotated(rotation) * speed
|
2024-09-11 18:19:06 +02:00
|
|
|
position += velocity * delta
|
2024-09-11 19:03:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
func _on_button_pressed() -> void:
|
|
|
|
set_process(not is_processing())
|
|
|
|
|
|
|
|
|
|
|
|
func _on_timer_timeout():
|
|
|
|
visible = not visible
|