Legend of the Gold Box... A game written for the LOWREZJAM 2018 game jam
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.

33 lines
769B

  1. import game.gbe
  2. _RUNNING = False
  3. def onKeyEvent(event, data):
  4. global _RUNNING
  5. if event == "KEYDOWN":
  6. if data["key"] == 27:
  7. _RUNNING = False
  8. print("Key {} down".format(data["key"]))
  9. elif event == "KEYUP":
  10. print("Key {} up".format(data["key"]))
  11. elif event == "KEYPRESSED":
  12. print("Key {} pressed".format(data["key"]))
  13. def start():
  14. global _RUNNING, onKeyEvent
  15. t = game.gbe.Time()
  16. t.reset()
  17. game.gbe.events.Events.listen("KEYDOWN", onKeyEvent)
  18. game.gbe.events.Events.listen("KEYUP", onKeyEvent)
  19. game.gbe.events.Events.listen("KEYPRESSED", onKeyEvent)
  20. d = game.gbe.Display()
  21. d.init()
  22. _RUNNING = True
  23. while _RUNNING:
  24. game.gbe.events.pollEmitter()
  25. d.close()