Advertisement
otorp2

grid move input is action

Nov 4th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1.  
  2. extends Area2D
  3.  
  4. # member variables here, example:
  5. # var a=2
  6.  
  7. var player_grid = Vector2(64,0)
  8. var player_act = Vector2(64,0)
  9.  
  10. func _ready():
  11.  
  12. set_process_input(true)
  13. pass
  14.  
  15. func _input(event):
  16.  
  17. if Input.is_action_pressed("ui_left"):
  18. set_pos(get_pos() - player_grid)
  19. if Input.is_action_pressed("ui_right"):
  20. set_pos(get_pos() + player_grid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement