Adventure Update
- seanmcgarry65
- Dec 2, 2022
- 2 min read
It's been a while since my last blog update. In that time, a lot of progress has been made, all of it on coding.
This block of code controls the animation for the player's sword

This code block handles everything that happens when the player hits an enemy with their weapons. Among other things, it knocks the enemy back, causes them to flash, and calls a function to check if they've lost enough health to die.

This is the function that controls weather or not an enemy dies when it takes damage. It also handles the code that plays a sound when the enemy is hit.

This function and the code calling it activate enemies when they appear on screen and control their movement and attack patterns.

More detail on how enemies move once the pattern is chosen by the function that controls that part of the code. This code also prevents enemies from walking through solid objects.

This part of the code checks to see how far a given enemy has wandered from its starting location, and tells it to turn around if it gets too far away.

These two code blocks turn enemy AI off when they aren't onscreen and record the spawn location for the previous code block respectively.

This code tells the Octorok enemy to stop moving, wait, fire a projectile, wait, and start moving again, every time a timer goes off.

This code is essentially the reverse of how the player damages an enemy; when an enemy or one of their projectiles collides with the player, it subtracts the damage value from the player's health.

The game is still far from finished, but what has been done so far can be played by following the link below:
Comments