Advertisement
otorp2

handy left right logic bool gate

Nov 4th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. extends Area2D
  2.  
  3.  
  4. var is_pressed = false
  5. func _ready():
  6. set_process(true)
  7. pass
  8. func _process(delta):
  9. if Input.is_action_pressed("ui_left"):
  10. if is_pressed == false:
  11. goleft()
  12. else:
  13. is_pressed = false
  14.  
  15. elif Input.is_action_pressed("ui_right"):
  16. if is_pressed == false:
  17. goright()
  18. else:
  19. is_pressed = false
  20.  
  21. pass
  22. func goleft():
  23.  
  24. print("go left")
  25. is_pressed = true
  26.  
  27. func goright():
  28. print("go right")
  29. is_pressed = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement