Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | javrocks |
extends KinematicBody2D
const UP = Vector2(0,-1)
var motion = Vector2()
var velocity = Vector2.ZERO
func _physics_process(delta):
velocity.x = 0
if (Input.is_action_pressed("ui_right")):
velocity.x = 300
elif (Input.is_action_pressed("ui_left")):
velocity.x = -300
velocity.y = 300
if (Input.is_action_pressed("ui_up")):
velocity.y = -10000
velocity = move_and_slide(velocity)
motion = move_and_slide(motion,UP)
print(is_on_floor())