DevLog 3: Enemies and Interactions


Enemies and Interactions

This is the third devlog for my game, Agent X regarding enemies and interactions.

For this checkpoint, I implemented the functionality of the enemies and the ability for a player to obtain scores when they kill an enemy and lose health when an enemy touches the player.

 

Implementation

Figure 1: Enemy Animation

The above sprite-sheet consists of the enemy movement of walking east and west. Besides that, the enemy uses A* Pathfinding to go after the player as can be seen in the GIF below:


The code for the A* Pathfinding was downloaded from an online A* Pathfinding Project. The code enables the game environment to be scanned, to automatically detect obstacles and places where the enemy can walk on. In addition to that, an Enemy AI script was created that has access to the Pathfinding script enabling the enemy to find and follow the player. The Enemy AI script is also written to allow the enemy to jump across gaps in the game so that it can follow the player throughout the level. This functionality is shown in the GIF below:


After the enemy movement was implemented, the interaction between the enemy and the player was attended to.

Firstly, the enemy has the ability to hurt and kill the player. This is done by using a script that decreases the player’s health whenever the enemy is touching the player. If the enemy continues to collide with the player, the player loses 1 health for every 0.5 seconds the enemy hits the player. This is represented in the GIF below:


Notice how the player’s health decreases whenever the player runs into the enemy.

The player is also able to kill the enemy and collects a point for every enemy killed as illustrated in the GIF below:

As can be seen, the score increases by 1 when the enemy bursts, splashing its blood everywhere!

 

Additional Features

Interaction of player and game world

Different kinds of traps and obstacles have been since added to the game from last week. Firstly is a moving platform in which the player has to time their jumps to catch it. Besides that is a laser that periodically turns on and off. Finally is a platform that bounces when the player lands on it. As from last week, there are also powerups that the player may collect which increases their health and increases the damage they deal with their gun.


Feedback

I love how you drop from one level to the next, maybe having a sign or something to let players know that it’s safe to drop down there would be good.

Thank you for pointing that out. I will add a text on the wall at the end that tells players to drop down.

Hey Brian, games looking good. Like Frederick said, mid-air movement to avoid spikes is a nice addition. As far as this checkpoint goes, enemy AI still function exceptionally well in your game and still chase you down with haste.
Enemy AI functions well.

Thank you very much!

For the moving platform in level 2, might be good for the player to be moved by the platform as well.

I will implement that, thank you for pointing that out!

In this part the background desk kinda looks like a platform that could be jumped on, could be interesting if there was a stationary platform above a moving platform so the player has to jump off the moving platform onto the stationary one as the moving one moves underneath, then the player jumps back on the moving platform once it has cleared the other platform.

For this feedback, I have now added a stationary platform in certain areas of the level and changed the colours of the desks in the background.

Thank you to everyone who provided me with feedback to improve my game.


General Fixes and Updates

Your bullets are dependent on your velocity. That is, if you shoot right while running right, it is faster than shooting right while standing still, which is again faster than shooting right while running left.

The velocity factor in the PlayerShooting script that was causing this issue has been removed, thus resolving the problem.


References

Arongranberg.com, n.d, A* Pathfinding Project, viewed 30 August 2021, <https://arongranberg.com/astar/>.

Fonts, F., n.d, MODEKA Free Modern Font - Free Fonts, viewed 30 August 2021 https://www.freefonts.io/modeka-free-modern-font/.

 

Files

Build.zip Play in browser
Sep 18, 2021

Leave a comment

Log in with itch.io to leave a comment.