2024-03-26 10:35:08 +01:00
|
|
|
extends Sprite2D
|
|
|
|
|
|
|
|
var speed = 400
|
|
|
|
var angular_speed = PI
|
|
|
|
|
2024-03-26 11:15:21 +01:00
|
|
|
func _ready():
|
|
|
|
var timer = get_node('Timer')
|
|
|
|
timer.timeout.connect(_on_timer_timeout)
|
|
|
|
|
2024-03-26 10:35:08 +01:00
|
|
|
func _process(delta):
|
2024-03-26 11:09:45 +01:00
|
|
|
rotation += angular_speed * delta
|
2024-03-26 10:53:32 +01:00
|
|
|
var velocity = Vector2.UP.rotated(rotation) * speed
|
2024-03-26 11:09:45 +01:00
|
|
|
position += velocity * delta
|
2024-03-26 10:35:08 +01:00
|
|
|
|
2024-03-26 11:15:21 +01:00
|
|
|
func _on_timer_timeout():
|
|
|
|
visible = not visible
|
|
|
|
|
2024-03-26 11:09:45 +01:00
|
|
|
func _on_button_pressed():
|
|
|
|
set_process(not is_processing())
|