Code Representation

Algorithm:

  1. Include all standard libraries
  2. Create sprite for central piece
    1. Create a class for sprite
  3. Positioning
    1. Changes in x position for sprite
    2. Changes in y position for blocks
    3. Create a for loop
    4. User input
    5. When the right half of the screen is touched, the sprite moves to the right
    6. When the left half of the screen is touched, the sprite moves to the left
  4. Block Generation
    1. Create a set amount of blocks
    2. Create classes for each block
    3. Randomize block placement
      1. Guarantee big enough gap to get through blocks
    4. Movement of blocks down the screen
  5. Home Screen
    1. Create touch sensitive area using LCD touch
    2. Touch sensitive area sends the user to a different screen
    3. Start game
    4. Access stats
      1. Declare variables
      2. Assign current score
      3. High score
        1. If current score >= best run score
      4. Number of deaths
        1. Every collision adds one to deaths
    5. Look at Rules
    6. Credits
  6. Collisions
    1. Have a for look checking the positions of border pixels of the sprite before every screen refresh
    2. Have a loop checking the positions of the objects
    3. In case of collision
      1. Display “you died”
      2. Increment deaths
      3. Return to home screen