PyZombis icon indicating copy to clipboard operation
PyZombis copied to clipboard

sample game using pygbag and pygame

Open sujith-rek opened this issue 2 years ago • 1 comments

Summary

This PR is to explore the option of using pygbag for pygame. This game is simple one where a square moves according to keystrokes

How to run

To run, you need to be in challenges directory and run the following

pygbag snake

Issues I noticed

  • It takes significant time to load
  • After the first game which I added here, I also tried for simple snake game which isn't heavy but takes 5x time
  • When I tried this for current existing pygame challenge, there are components which are for web and while installing gives dependency issues

Other potential issues

  • No idea how we can use this *.py pygame file and host the game ( once the pyscript component is done, we can include this in src and compile online?)

How to make pygame compatible with pygbag

  • add this import statement import asyncio
  • Encapsulate all the variables
  • after every pygame.display.update() add await asyncio.sleep(0)
  • make the main pygame function async (add async before def)
  • run the pygame using asyncio.run( <function name>)

sujith-rek avatar Mar 24 '23 20:03 sujith-rek

Published to http://pyar.github.io/PyZombis/253/index.html

github-actions[bot] avatar Mar 24 '23 20:03 github-actions[bot]