17 lines
337 B
GDScript
17 lines
337 B
GDScript
extends Node2D
|
|
|
|
@export var speed = 400
|
|
var velocity = 0
|
|
|
|
func get_input():
|
|
if Input.is_action_pressed("Slow Mode"):
|
|
speed = 200
|
|
else:
|
|
speed = 400
|
|
|
|
var input_direction = Input.get_vector("Left", "Right", "Up", "Down")
|
|
velocity = input_direction * speed
|
|
|
|
func _physics_process(delta):
|
|
get_input()
|
|
position += velocity * delta
|