Advertisement
otorp2

incrementing decrementing global timer

Nov 28th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. extends Node2D
  2.  
  3. var is_counting = true
  4. var countup = 0
  5.  
  6. func _ready():
  7. pass
  8.  
  9. func _on_Timer_timeout():
  10.  
  11. print(countup)
  12. if countup == 10:
  13. is_counting = false
  14. elif countup == 0:
  15. is_counting = true
  16. if is_counting == true:
  17. countup += 1
  18. else:
  19. countup -=1
  20.  
  21.  
  22. pass
  23.  
  24. #otorp2, just add a boolean variable that switches at 10 and 0
  25.  
  26.  
  27. #if countup == 10: bool-var-name = false
  28.  
  29. #else if countup = 0: bool_var-name = true ||||
  30.  
  31. # and in your incrementor if bool_var_name == true: incrementor +1 else incrementor -1
  32. #[17:02] <scionicspectre> Oh, good to know it's actually feasible with Veraball.
  33. #[17:03] <dc1a0> oops forgot the 2nd = in the countup == 0...lol
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement