The game is starting to take shape: the gnome’s art has been updated, the UI has been updated, and the backgrounds look nice. Currently, we only have one type of trap: the brown spikes. Our next steps will be to create two more themed versions of these static spikes, to add a bit more variety.
We’ll also add a new type of trap: the spinning blade. The spinning blade deals the same kind of damage as the spikes, but is slightly more complicated—it’s composed of three sprites, one of which is animated.
Finally, we’ll add some non-damage-dealing stuff, in the form of walls and blocks that the player will need to navigate around. These objects, when placed in conjunction with traps, will force the player to think carefully about how they’re going to navigate the level.
Let’s start with the themed spikes. We currently already have a prefab for the existing sprites; all that needs to change is to update the sprites and regenerate the collider. To do so, follow these steps:
Create the new prefabs for the spikes. Select the SpikesBrown prefab, and create a duplicate of it by pressing Ctrl-D (Command-D on a Mac). Name this new object “SpikesBlue”.
Make another copy, and call it “SpikesRed”.
Update the sprite. Select the SpikesBlue prefab, and change the sprite to the SpikesBlue image.
Update the polygon collider. Because the polygon collider is on the same object as a Sprite Renderer, the collider uses ...