Untitled
unknown
plain_text
a year ago
768 B
6
Indexable
extends Sprite var boost_speed := 1500.0 var normal_speed := 600.0 var max_speed := normal_speed var direction := Vector2.ZERO var velocity := Vector2.ZERO func _process(delta: float) -> void: direction.x = Input.get_axis("move_left", "move_right") direction.y = Input.get_axis("move_up", "move_down") # Limit the direction vector's length by normalizing the vector. if direction.length() > 1.0: direction = direction.normalized() velocity = max_speed * direction if Input.is_action_just_pressed("boost"): max_speed = boost_speed get_node("Timer").start() position += velocity * delta if direction: rotation = velocity.angle() func _on_Timer_timeout(): max_speed = normal_speed # Replace with function body.
Editor is loading...
Leave a Comment