godot/scripting_first_script/Sprite2D.gd

20 lines
399 B
GDScript3
Raw Normal View History

extends Sprite2D
var speed = 400
var angular_speed = PI
func _ready():
var timer = get_node('Timer')
timer.timeout.connect(_on_timer_timeout)
func _process(delta):
rotation += angular_speed * delta
var velocity = Vector2.UP.rotated(rotation) * speed
position += velocity * delta
func _on_timer_timeout():
visible = not visible
func _on_button_pressed():
set_process(not is_processing())