Scroll Down

SIMON SAYS

A Java Swing game

  • Simon Says Screenshot 1
  • Simon Says Screenshot 2
  • Simon Says Screenshot 3
  • Simon Says Screenshot 4
  • Simon Says Screenshot 5

Objective

With this project, I wanted to further explore Java graphics and user-interactive game development. I did some research and came across the concept of a Simon Says game. I immediately thought it would be a great project to build on those skills while making something fun and engaging.

Game Description

  • The program will display a pattern by highlighting one color pad at a time.
  • User will attempt to repeat the pattern by pressing on the pads in the correct order.
  • User accumulates score with each correct pressing.
  • After successfully completing a pattern, user will go up a level. Pattern will become longer with each level.
  • Game is over when user presses a wrong pad.

Implementation

I’ve designed four classes: Simon, ColorPad, ScoreBoard, and Pattern.

Simon is the managing class, it dictates the game flow and graphics while responding to the user’s interactions. Simon initializes the pads with instances of the ColorPad class. Creating the pads as objects allows the number of pads displayed in the game very flexible. Displaying new pads is just a matter of creating a new object and giving it a color and a size.

Simon Says UML Class Diagram
UML Class Diagram for Simon Says

While I initially had ScoreBoard and Pattern as part of the Simon class, I decided declaring two additional classes for them is the better design choice. The reasoning behind my decision was that creating random patterns and making score calculations within the Simon class hurts its cohesion. Since the calculations of the scores and patterns are not part of the game’s control-flow, doing these calculations on separate classes keeps the focus of the Simon class on game-flow and graphics.