top of page

Penny Pixel

Game.png

Penny Pixel is a single-player two-dimensional platformer game. The player can move to the left using the A key and to the right using the D key. The player can jump using the space key. The purpose of the game is to collect all of the gems that are in the level. The players progress in collecting these gems is shown in the upper left corner of the screen. The player only has 5 lives per level, represented in the upper right corner of the screen by Penny Pixel's heads. The player loses lives by falling off the platforms and into space or by getting hit by an enemy. The player can gain back lives by picking up hearts. If the player runs out of lives, the game will restart.

This code snippet to the right is the ComputeVelocity method from the PlayerController script. This method is used to calculate and control the movement and speed of the player. Additionally, this method controls the parameters of the animator, which controls when Penny Pixel's different animations will play.

PlayerControllerComputeVelocity.png
PlayerControllerCheckpoint.png
PlayerControllerPickup.png
PlayerControlllerFallDetector.png

The code snippets surrounding this text are the different checks for collisions in the PlayerController script. In the Enemy/Life/FallDetector collisions, the correct cell of the matrix of lives is set to true or false depending on if the collision was with an enemy or a heart, and the player is sent back to their respawn point (not for a life). A checkpoint collision will update the respawn point.  When a player picks up a gem, they will get a boost to their speed and jump height for five seconds, as well as increase the number of gems they have collected, which is the goal of the game.

PlayerControllerEnemy.png
PlayerControllerLife.png

This code snipper to the right shows the SetCountText method in the PlayerController script. This method is used in the pickup collision check, and is used to update the number of gems collected by the player, and update this in the upper left hand corner of the screen.

PlayerControllerSetCountText.png
TitleScreen.png

The image to the left shows the title screen of Penny Pixel. The player has the options of starting the game, entering the options screen, or quitting.

The image to the right shows the particle effect that is played after the player picks up a gem. This particle effect is played, and the gem disappears.

GemEffect.png
AfterHit.png
AfterHealthPickup.png

These images to the left show the changes tot he health of Penny Pixel. In the top picture, Penny Pixel has just been hit by the enemy (the flying dragon), and now only has four lives, which can be seen by the fact that there are only four heads in the top right corner of the screen. But in the bottom picture, Penny Pixel now has all five lives (heads), because she picked up the heart that was to the left of her in the top picture.

The code snippet to the right shows the Update and Move methods in the EnemyBehavior script. The enemy GameObject has a matrix that holds multiple waypoints (empty GameObjects at specific positions). The Move method uses the Vector2.MoveTowards method to gradually move the enemy between two points. In the Update method, the attack animation of the enemy is gradually called every five seconds, and the Move function is called every update.

EnemyBehaviour.png
bottom of page