Enemies and Interaction


Enemies and Interaction

Enemies

Pathfinding

Previously enemies were pathing directly to the players position, leading to enemies walking into walls. To combat this issue a pathfinding system was needed.  I implemented this feature by using nodes that connect to each other all over the walkable area. Instead of manually adding nodes I used a node generator that places nodes all over the map excluding inside walls. The path is calculated by the fewest nodes it takes to reach the player.




Initially my layermask to stop nodes generating past walls wasn't working. This was because I had my tilemaps collision on outlines, so I changed it to Polygons and then it started working correctly.



Demonstration of the node pathfinding:

Enemy Sprites

The first enemy I made was a zombified version of the player, complete with animations!


Interactions

Shooting

Shooting works by spawning bullet prefabs when clicking. When a bullet hits a wall it changes layer to prevent damage to enemies, and slides and spins across the ground.

When enemies are shot blood is splattered everywhere!


Sound effects for shooting and reloading have been added from Snake's first and second Authentic Gun Sounds And More sound packs. I also added a simple chomping sound when the player takes damage. I recorded myself making some crunching sounds eating some chips (yummy!).

I finally got around to adding rotation to the weapon based on cursor position.


Leave a comment

Log in with itch.io to leave a comment.