DEVLOG - Enemies


Third week of game making, and I have developed two types of enemies, these have been named the basic ghost and the strike ghost, so far, all ghost sprites are currently just basic filler sprites from unity’s sprite list. The basic ghost constantly goes back and forth between two invisible game objects. To make sure the basic ghost stays between the two objects I have used a curve with the ping pong type of repeat. Using the curve also allows me to change the function of future ghost if I decide to. To allow this curve to work I have used and evaluate command inside a vector three lerp command between the two positions. After getting the movement to work I needed to get the sprite to also flip to make sure the sprite was facing the way it was moving. To do this I used the ghost’s movement as the determining factor. To do this I have set one of the invisible objects as a reference point. The code takes the position of the ghost at one point in time and then take its position later in time. If the ghost is closer to the reference point than it was before the sprite is flipped one way if its further away the sprite is flipped the other way, Gif 1. 

Gif 1 ghost flipping when turning direction

The second ghost, the strike ghost, was originally made just to follow the player. After getting the code finished and getting the ghost to follow the player, an issue where the ghost would instantly be able to remove the three lives the player will have. To fix this I put a circle collider 2D around the player, when the ghost collides with this radius it causes a dash in a set direction for a set time. Gif 2. After the dash finishes the ghost starts to follow the player again and the cycle continues. This only allows the ghost to take one life, but it also adds a more interesting ghost to the game. 

Gif 2 Strike ghost ability

Improvements

I am currently working on a spawner for the Striker ghost as they will only appear when the player is within a set radius of the spawner. I also must include ghost sprites as the following sprites used are a green tick and a black circle with a three on it.  

Leave a comment

Log in with itch.io to leave a comment.