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 978B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #u.draw_header(o)
  31. #self.draw_footer(o)
  32. #self.draw_main(o)
  33. #o.update_display(0)
  34. pass
  35. if o.keyState[16] > 0 or o.keyState[17] > 0:
  36. #if o.keyState[16] > 0:
  37. pass
  38. else:
  39. self.gameFSM.Execute()
  40. def Exit(self):
  41. pass
  42. #====================================