SHARE
TWEET

Untitled

a guest Jan 21st, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extends KinematicBody2D
  2.  
  3. const SPEED = 210
  4. var dir = "down"
  5. var move = Vector2()
  6.  
  7. func _ready():
  8.  
  9. func _physics_process(delta):
  10.     if Input_is_action_pressed("ui_up):
  11.         move.y += SPEED
  12.         dir = "up"
  13.         elif Input.is_action_pressed("ui_down"):
  14.             move.y -= SPEED
  15.             dir = "down"
  16.     else:
  17.         move.y = 0
  18.    
  19.     if Input.is_action_pressed("ui_right"):
  20.         move.x += SPEED
  21.         dir = right
  22.         elif Input.is_action_pressed("ui_left"):
  23.             move.x -= SPEED
  24.             dir = left
  25.  
  26. move_and_slide()
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
Top