Simple Brython example
This is a simple example of using the Brython library for making HTML5 games written in Python.
Use the left and right arrow keys of your keyboard to move the red circle on the canvas.
The original goal is to be able to port games, initialy developped on www.codeskultor.org, over to Brython (
http://www.brython.info ) since the CodeSkultor
libraries are not open source and the owners, do not allow the use of their libraries outside of the codeskultor.org website.
Brython, however, is open source and free (as in: freedom) and the games developped with it can be hosted anywhere you choose. See the licence info on the Brython website.
The Python source code used for this simple demo can be found here:
simple.py
This example covers :
- Timers
- Displaying text on the canvas
- Displaying an image on the canvas
- Playing sounds
- Handling keyboard events
- How to integrate all this with your Python code (classes / functions)
With these simple ingredients, you can code up games like Pong, Arkenoids, Asteroids, etc... the choice is yours, enjoy! :)