raspberry pi zero based drum machine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sDefender.py 856B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import FSM
  2. import utils as u
  3. import menus as m
  4. #====================================
  5. State = type("State", (object,), {})
  6. #====================================
  7. class State(object):
  8. def __init__(self, FSM):
  9. self.FSM = FSM
  10. def Enter(self):
  11. pass
  12. def Execute(self):
  13. pass
  14. def Exit(self):
  15. pass
  16. class Defender(State):
  17. def __init__(self,FSM):
  18. super(Defender, self).__init__(FSM)
  19. def Enter(self):
  20. o = self.FSM.owner
  21. self.gameFSM = FSM.DefenderFSM(o)
  22. super(Defender, self).Enter()
  23. def Execute(self):
  24. o = self.FSM.owner
  25. m.menu1_actions(self, o)
  26. if o.keyState[16] == 1:
  27. m.draw_menu1(o)
  28. o.update_display(0)
  29. elif o.keyState[16] == 4:
  30. pass
  31. if o.keyState[16] > 0 or o.keyState[17] > 0:
  32. pass
  33. else:
  34. self.gameFSM.Execute()
  35. def Exit(self):
  36. pass
  37. #====================================