Skip to content

GameLogic subsystem

Evan Harvey edited this page Apr 25, 2016 · 4 revisions

Activity Diagram

This diagram describes the overall logic behind the game itself. The diagram is generic and does not depict the specific interactions of the Shapes App. Those specific interactions will be explained below along with the diagram.

1 User starts the game

  • This subsystem is called upon and starts running

2 Initialize play area

  • start up necessary graphic libraries and any background processes needed to run the game
  • for shapes this will load the blocks and the grid that they will be used on

3 load level data

  • load the data for that level of the game
  • for shapes this will likely be the order the blocks fall

4 enter game loop

  • at this point all game assets have been loaded and the game can begin

5 advance time

  • move the game forward one tick
  • for shapes this will include moving falling blocks downward and playing any animations (like a rotating block)

6 check for user input (in game loop)

  • did the user press anything since the last time this was called?
  • yes: go to 7
  • no: go to 8

7 update play data based on user input

  • alter values and start any animations in reaction to the user input
  • for shapes, if a block was pressed, start the animation to rotate that block

8 update play data

  • update the game data based on the advancement of time by one tick
  • for shapes this will include updating blocks that have finished an animation or have finished facing

9 check if updated play data activates a play mechanic

  • does the update from 8 activate a game mechanic?
  • for shapes this would check if a shape has been formed by the blocks
  • yes: go to 10
  • no: go to 5

10 change play data, did the game end?

  • use the game mechanic in 9 to alter the game data
  • in shapes this will include starting the animation for removing the blocks that created a shape and adding to the score
  • did the game end by the game mechanic?
  • yes: go to 11
  • no: go to 5

11 display game over screen

  • for shapes this will show the score acquired during play and compare it to the high score, may have more options depending on the UI here

12 wait for user input (in game over screen)

  • Exit the subsystem when the user gives the right input, otherwise wait