mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-05 07:20:07 +01:00
13 lines
431 B
GDScript
13 lines
431 B
GDScript
extends KinematicBody2D
|
|
|
|
const MOTION_SPEED = 160 # Pixels/second
|
|
|
|
func _physics_process(_delta):
|
|
var motion = Vector2()
|
|
motion.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
|
motion.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
|
motion.y *= 0.5
|
|
motion = motion.normalized() * MOTION_SPEED
|
|
#warning-ignore:return_value_discarded
|
|
move_and_slide(motion)
|