Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends KinematicBody2D
- const SPEED =200
- const GRAVITY = 10
- const JUMP_POWER = -400
- var velocity = Vector2()
- func _process(delta):
- velocity.y += GRAVITY
- if Input.is_action_pressed("ui_right"):
- velocity.x = SPEED
- elif Input.is_action_pressed("ui_left"):
- velocity.x = -SPEED
- else:
- velocity.x = 0
- if Input.is_action_just_pressed("ui_up"):
- velocity.y = JUMP_POWER
- move_and_slide(velocity)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement