Skip to content
Riemann edited this page Nov 20, 2013 · 11 revisions

This is the representation of the terrain.

Important Fields:

  • imageBuffer A byte array of RGBA values that we can use for pixel operations.
  • image A graphical representation of our map.
  • linearHeightMap A 1d array of height values used to speed some operation up.

Generation

The map currently generates using a heightmap. This heightmap is procedurally generated by starting at one point on the screen and using random values to determine if the next x value will: step up one, step down one, or stay at the same value. It then takes this heightmap and fills below those values, creating our map.This method is only temporary.

The linearHeightMap

This allows for quick detection of the top of the map. There are several operations to maintain this. Also, it allows us to find the max value in a certain range, something useful for collision detection as we do not have to check if all of our points are above this value.

Clouds

The clouds are Placed on the map in random locations at the start of the game and moving at random speeds between an upper and lower speed limit. Once a cloud runs past the screen or app container, the cloud will loop back to the other side of the screen just out of sight to allow it to float back into view.

Map Generation Example:

Created by: Zach H. and Ben Riemann

See: Source

Clone this wiki locally