2012-07-05 04:21:49 -04:00
|
|
|
----------------
|
|
|
|
Pygame Framework
|
|
|
|
----------------
|
|
|
|
|
2013-04-26 10:54:21 -04:00
|
|
|
Classes to facilitate creation of Pygame projects
|
2012-07-05 04:21:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
Example
|
2014-01-12 11:07:39 -05:00
|
|
|
-------
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2014-01-12 11:07:39 -05:00
|
|
|
Save and run to create a project that redraws a square at a random location
|
|
|
|
every second. This script is also written in the `sample.py` file.
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
from time import sleep
|
|
|
|
from random import randint
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
from pgfw.Game import Game
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
class SampleGame(Game):
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
square_width = 30
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
# instructions in the update method automatically run once every frame
|
|
|
|
def update(self):
|
|
|
|
sleep(1)
|
|
|
|
screen = self.get_screen()
|
|
|
|
bounds = screen.get_size()
|
|
|
|
screen.fill((0, 0, 0))
|
|
|
|
screen.fill((255, 255, 255),
|
|
|
|
(randint(0, bounds[0]), randint(0, bounds[1]),
|
|
|
|
self.square_width, self.square_width))
|
2012-07-05 04:21:49 -04:00
|
|
|
|
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
if __name__ == '__main__':
|
|
|
|
SampleGame().run()
|
2012-07-05 04:21:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
License
|
2014-01-12 11:07:39 -05:00
|
|
|
-------
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
MIT License
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
see LICENSE.txt for details
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2012-08-02 17:38:18 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
Business
|
|
|
|
--------
|
2012-08-02 17:38:18 -04:00
|
|
|
|
2021-05-29 20:50:14 -04:00
|
|
|
420@shampoo.ooo
|