Day 4 of my time working in the GameDevHq program involved resuming my work on the courses made for 2D game development to create a simple space themed shooter game. Where I last left off with the course I had finished programming the basic mechanics for the game that establish an effective prototype to build off of.

The mechanics that were made for the prototype were as follows:

  • Creating a player, enemy, and laser game objects.
  • Scripting the basic controls to allow the player to move, shoot enemies, and receive damage from colliding with enemies.
  • Scripting enemy behavior to periodically spawn new enemies with randomized starting positions along the x-axis and translate downwards. Additionally any enemies that reached the bottom of the screen would be reset to the top of the screen to descend again.

For today the assets of the game were switched out from the placeholder prototype graphics to the high quality assets that were provided by the course. This required a rework of some of the assets from 3D object to 2D sprites.

The placeholder graphics at the end of the prototyping phase.
The new graphics of the game after player, laser, enemy, and background assets were swapped out.

Once the graphics were updated the process to expand the mechanics of the game. The mechanics that the course focused on implementing was a power up system for the following mechanics:

  • Triple shot: The player can pick up a power up item that allows them to fire three lasers at once for a 5 second window. This was done by reusing the prefab that was created for the laser mechanic and placed within an empty parent object to contain three copies of the laser.
  • Speed Boost: Increase the speed of the player on pickup of the powerup. This function resulted in some simple calculations where whenever the power up was collected the speed value for the player would be updated to double its value. Once the power up duration times out the current speed of the object that was previously doubled will be halved back down to the original starting speed.
  • Shield: Prevent damage from being done to the player on collision. This was a two part function as it had both a mechanical part and a visual aspect to its implementation. The logic was simple in that the damage function simply skips subtracting any lives from the player while the shield is active. The key part for the visual implementation was to activate/deactivate a Unity game object through a script, which can be handled by the SetActive() function. This allows the game to show and hide the visuals for the shield whenever needed.
The implemented visuals for the player shields when activated.

At the time of this writing I have finished implementing all of these functions and I am aiming to start on implementing the user interface for the game tomorrow.

An aspiring game-dev from Hawai’i. Previous experience was in programming and animation work.