A breakout / arkanoid clone made in pygame, by AdmiJW
Download the game in dist.rar
. Extract and run main.exe
. Give it some time to load, and enjoy!
Most of the controls are done using WASD or Arrow Keys. Selection by using Spacebar or Enter/Return key.
- 5 powerups:
- Longer Paddle
- Stronger Ball
- Into the future - Allows you to see the projectory of the ball ahead of time
- Recover Health
- Double ball - Introduces a second ball into the game
- Design patterns used include:
- Singleton - CONFIG, CONSTANT, Audio etc
- Strategy - Powerups apply different strategy to render() and update() in Playing state
- State - Game is state machine. Avoid if else as much as possible
- Null Object - NullBall to avoid null checking on balls
- Decorator - render() has decorators applied to draw fps, heart and score, and powerup timeleft
- At one point, the game had memory leaks where RAM usage increases as the player progresses the level. The reason was due to dangling reference to Playing state when implementing Strategy pattern via
types.Methodtype()
. This causes the garbage collector to unable to free the memory of thePlaying
state. Problem is fixed once I changed the implementation of Strategy pattern. Lesson: Be careful when implementing strategy viatypes.MethodType()
or__get__
magic method. It may end up in cyclic reference if you are not careful.
-
Tile graphics retrieved from OpenGameArt
-
Background generated via Magic Pattern
-
Music and sound effects are created by myself.