Skip to content

AdmiJW/Break0ut

Repository files navigation

Break0ut

A breakout / arkanoid clone made in pygame, by AdmiJW

Demo 1 Demo 2 Demo 3



Usage:

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.



Features:

  • 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


State Machine

State Machine Diagram



Implementation Notes

  • 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 the Playing state. Problem is fixed once I changed the implementation of Strategy pattern. Lesson: Be careful when implementing strategy via types.MethodType() or __get__ magic method. It may end up in cyclic reference if you are not careful.

Other:

  • Tile graphics retrieved from OpenGameArt

  • Background generated via Magic Pattern

  • Music and sound effects are created by myself.

About

Break0ut / Arkanoid game clone made using pygame, by AdmiJW

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages