Game development can be a daunting task when suggested, especially if never attempted before. But in all honesty they are not so bad. Exercise number six was to create a game, so I did, Silhouette Runner. The naming of my game is quite self-explanatory when played, but the idea might not be.
From some random previous knowledge I knew that most games, if not all, utilize a main game loop. This loop makes sure that all updates happen and are displayed on the users' screen and in my case the HMTL5 canvas. I also knew that the update had to occur specified amount of time per second, to produce smooth flowing animations.
Right off the bat I realized that any work beyond 2D would take too long and I would not be able to reach the deadline in time. So I decided to create an infinte 2D side scrolling game, where the objective was to jump over hills and land in valleys, not entirely unlike the game Tiny Wings.
The main challenge was to create dynamic hills and valleys that would be perceived as silhouettes of mountains in the distance. This was achieved though clever usage of the Gaussian Function, also known as the bell curve, found by Carl Friedrich Gauss. Each mountain was a random curve placed uneven distances from each other, as to create a wave with random heights. Each mountain's coordinates were placed in an array that then could be used to correctly position the player in the Y position. From the array of points I could also draw lines between each one and find the delta Y so that the game could regulate the player entity's speed based on the delta distance. The rest of the game is just keeping track of the score and moving the moon that the character in the hat is trying to catch.