godot-docs/scripts/icon.gd

22 lines
424 B
GDScript3
Raw Normal View History

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)
func _process(delta: float) -> void:
2024-09-11 19:03:50 +02:00
rotation += angular_speed * delta
var velocity = Vector2.UP.rotated(rotation) * speed
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