mirror of
https://github.com/Relintai/pandemonium_demo_projects.git
synced 2024-12-21 13:56:50 +01:00
14 lines
471 B
GDScript3
14 lines
471 B
GDScript3
|
extends KinematicBody2D
|
||
|
|
||
|
const MOTION_SPEED = 160 # Pixels/second.
|
||
|
const TAN30DEG = tan(deg2rad(30))
|
||
|
|
||
|
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 *= TAN30DEG
|
||
|
motion = motion.normalized() * MOTION_SPEED
|
||
|
#warning-ignore:return_value_discarded
|
||
|
move_and_slide(motion)
|