ZeroSeventty

Intervals with python

Mar 22nd, 2021 (edited)
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. import threading
  2.  
  3. def Interval(function, time):
  4.     event = threading.Event()
  5.     while not event.wait(time):
  6.         function()
  7.  
  8. def shipDamage():
  9.     print("Rest -1 to the ship by non-explote balloons")
  10.  
  11. Interval(shipDamage, 5)
  12.  
Add Comment
Please, Sign In to add comment