Enemies, Interaction, Puzzles


The focus this time was on adding enemies and thinking about any additional gameplay/puzzle mechanics to add to the game.

Enemies/Hazards


A basic enemy intercepts and chases the player

This chaser enemy follows players using A-Star pathfinding that was introduced in Tutorial 11 of Games Fundamentals.  The enemy doesn't damage the player - the only thing that can defeat the player is the deadly tiles - but the enemy can obstruct the player and gain time for the trail of deadly tiles to catch up.  It is possible to lose the enemy if you get far enough away from it - this was achieved with the help of Unity (2021) documentation on measuring the distance between two objects.

Moving electric projectiles can stun the player and reduce their speed considerably for a few seconds

These "electric" orbs reduce the player's movement speed if they collide with the player.  The player has a deactivated stun effect object that follows them around and it is activated upon collision with the orb, credit to Hellshand (2021) for how to activate/deactivate the object.  I am thinking of programming more movement patterns for the orbs rather than just ping-ponging so that they are a bit more versatile.

Mechanics/Puzzles

You can now die and respawn at a checkpoint if you stand on a deadly tile

Previously the player's interaction with the deadly tiles was pretty lame - the player just got deleted if they stood on one and you'd have to reload the game to try again.  Now the player will disintegrate in a burst of particles, which I'll probably tweak to look nicer when I work on the graphics.  After their death the player returns to the checkpoint and all of the deadly tiles are reset in functionality (credit to Christian Salvadó (2009) for the simple solution) but unfortunately I haven't been able to return their appearance to normal yet - this is in progress.

I think the fundamental gameplay mechanics are now implemented, but I have been wanting to improve the current progression system where you simply step on a switch to remove the barrier and progress.  I have decided that it would be more interesting if you completed a puzzle to get a key as a reward, and my idea for the puzzle comes from the original inspiration for the game, which was the Sootopolis Gym puzzle from the Pokémon series.  

A sample of the puzzle in the sixth generation Pokémon games - step on all the tiles, but never any twice, to clear the board and progress (Madrigal et al. 2016)

I am working on a new kind of "breakable" tile that sits on top of regular deadly tiles, preserving the deadly functionality while adding a new appearance and feature to the tiles.  When you step on one of these new breakable tiles it will disappear, revealing the regular deadly tile underneath.  I will replace the switches with a small room full of these tiles, and the new objective will be to move carefully to break all of the tiles in the room to obtain a key to one of the barriers.  I also think these tiles could be used for the boss "battle" that will be at the end, where you will have to step on all the tiles to beat the boss while they try to stop you.

Feedback

The red dots probably need a bit of a tweak though as they can get stuck sometimes. You might want try giving them a similar sort of grid based movement to the player as well to keep movement consistent.

Because the enemy is working with A-Star pathfinding (from Tutorial 11) I am finding it quite difficult to merge it with the grid-based movement system that was developed for the player.  It does look a bit inconsistent having the player grid-locked and the enemy free-roaming though so I will definitely take this on board and experiment more with the A-Star code.  The player's movement system is almost foolproof when it comes to issues with collision or getting stuck, so if I can implement it the problems with the enemies getting stuck should be fixed.

References

Hellshand (2021), 2020 Unity. How do I set children of a parent object to be active? Unity Answers, https://answers.unity.com/questions/1827867/2020-unity-how-do-i-set-children-of-...

Madrigal, H, et al. (2016), Sootopolis City Pokemon Gym. IGN, https://www.ign.com/wikis/pokemon-omega-ruby-alpha-sapphire/Sootopolis_City_Poke...

Salvadó, C (2009), c# - How to reset a Dictionary. Stack Exchange, https://stackoverflow.com/questions/1978821/how-to-reset-a-dictionary

Unity (2021), Unity - Scripting API: Vector3.Distance. Unity Documentation, https://docs.unity3d.com/ScriptReference/Vector3.Distance.html

Leave a comment

Log in with itch.io to leave a comment.