SHARE
TWEET

Untitled

a guest Feb 4th, 2019 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extends KinematicBody2D
  2.  
  3. const SPEED =200
  4. const GRAVITY = 10
  5. const JUMP_POWER = -400
  6.  
  7. var velocity = Vector2()
  8.  
  9.  
  10. func _process(delta):
  11.  
  12.     velocity.y += GRAVITY
  13.  
  14.     if Input.is_action_pressed("ui_right"):
  15.         velocity.x = SPEED
  16.  
  17.  
  18.     elif Input.is_action_pressed("ui_left"):
  19.         velocity.x = -SPEED
  20.  
  21.  
  22.     else:
  23.         velocity.x = 0
  24.  
  25.  
  26.     if Input.is_action_just_pressed("ui_up"):
  27.         velocity.y = JUMP_POWER
  28.  
  29.     move_and_slide(velocity)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top