During the week of March 11th 2019, I added combat in Unity in the form of an enemy to fight.
The objective behind this task was to create a slime-esque creature that the player could fight and defeat. I decided to take advantage of the player’s current abilities, punching and kicking, when creating the enemy.
The slime patrols a region randomly, but will detect the player once they come within a certain distance that can be customized. Upon doing so, the slime will home onto the player, randomly doing hops, the distance of which can also be customized.
If the player and slime intersect, both parties will bounce off each other, but the player’s velocity will determine who takes the most damage. If there are above a certain value that means they are at a high enough speed, the slime will bounce back further and will take damage. If the player is still or barely moving, the slime will knock the player back further, which has the possibility of knocking them off the arena.
The player can also punch the slime to deal damage to it. It’s a riskier move but requires no movement.
Once the initial slime is dealt damage to three times, it will be sent flying to indicate its defeat. Two smaller more slimes will fall from the sky, which upon being defeated, will cause four even smaller slimes to fall. This is done by hiding the slimes on invisible platforms high in the sky, that disappear upon conditions being met, such as the higher tier slime(s) being defeated.
In hindsight, having slimes spawn in response to the original being defeated would have been a more engaging way to fight that would have kept the player focused on the battle, rather than having to wait for additional slimes to drop into the battlefield.
There is also an audio cue to indicate the slime being hit (not present in the video due to lack of audio), but a visual cue would have definitely been more effective to indicate damage, such as the slime flashing slightly. This would do a better job of providing positive reinforcement to the player which would encourage them to repeat the process now that they know it is the right move to make.