2009-08-23 Python PyGame Tutorial
Python Pygame tutorial. This tutorial goal show how to make small and simple pygame pythone script that include all that is need for bigger application. Every tutorial part add only few new lines of code.
Moving Boxes
Goal
Make featured applications with boxes that coaliding one with another.
1. [Set Display]
2. [Event Sytem]
3. [Image loading]
4. [Box object]
5. [Box move]
6. [Boxes move]
7. [Randomnes]
8. [Fullscreen]
2009-11-12 Python PyGame Tutorial Fullscreen
added new variable tha tcheck in with mode now screen is
fullscreen = FalseUsed new event type
if event.type == pygame.KEYDOWN:
When pressing key m we making new screen surface in fullscreen mode. If screen is in fuulscreen mode make window.
if event.key == pygame.K_m: if not fullscreen: screen = pygame.display.set_mode( (SCREEN_X,SCREEN_Y) , pygame.FULLSCREEN ) fullscreen = True else: screen = pygame.display.set_mode( (SCREEN_X,SCREEN_Y) ) fullscreen = False
2009-09-23 Python Pygame Tutorial Randomnes
All boxes moving with same speed in same directions and all boxes have same size and color
Make changes step by step to see result
self.dx = randint(1,BOX_SPEED) self.dy = randint(1,BOX_SPEED)and boxes now moving all seperatly at diferent directions.
self.boxes.append( Box( i*2 , i*2 , randint(BOX_MIN_SIZE,BOX_MAX_SIZE) , (i,0,0) )now boxes have diferent sizes
Tutorial source