User Tools

Site Tools


p5bg:bullet_game

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
p5bg:bullet_game [2024/09/04 08:50] appledogp5bg:bullet_game [2024/09/11 06:42] (current) – removed appledog
Line 1: Line 1:
-= Bullet Game 
-Bullet Game is our near-end stage pygame 2d game framework example. We've already done at least 6 or 7 other games using pygame. So this will document the patterns we have learned. 
- 
-We began by "just writing" a game, then the second part was refactoring the game. I wanted to make refactoring it's own project. What are the goals of this refactoring? 
- 
-* Refactoring 
-** Encapsulation 
-** Light Commentary (code commentary) ex. IN and OUT for functions. 
- 
-The primary goal is encapsulation. So, we're going to break up the old main into several new classes. 
- 
-== PyGame Framework 
-The first part of this is the use of [[pygame framework]]. We'll describe the additions here. 
- 
-== Bullet Game 
-Here is the code we added, starting with main.py: 
- 
-=== main.py 
-<Code:Python> 
-from Window import * 
-from Game import * 
- 
-def main(): 
-    window = Window() 
-    window.setCaption("Bullet Game") 
-    window.setSize(Screen.WIDTH, Screen.HEIGHT) 
-    window.setFont("assets/ps2p.ttf", 32) 
- 
-    game = Game(window) 
-    game.start() 
- 
-if __name__ == "__main__": 
-    main() 
-</Code> 
  
p5bg/bullet_game.1725439849.txt.gz · Last modified: 2024/09/04 08:50 by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki