Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Out of curiosity, I downloaded the project file and looked up how you're handling the bats. I think using collisions might be making things more tricky, because onCollisionExit makes the bat forget the player and then go looking for it, so if you did have the bats circling, they'd go to leave the player then immediately turn around and go looking for them again. 

What you might try is not worrying about that part, but instead have the bat always know where the player is. Add a float timer and a Vector2 offsetPos at the top. 

When the bat hits the player collider and deals damage, set the timer to some random value and the offset position (offsetPos) to a vector2 that, when added to the player position, would place the bat just beyond the player's attack. 

If the timer is greater than 0, subtract Time.deltaTime from it, and have the bat move toward player.position + offsetPos. Else if the timer is less than 0, swoop in for the attack. When it collides, it'll deal damage, reset the timer and offset, and swoop back out.

ill have to do some reading on offsetPos. it sounds like it could work. 

oh it's not any sort of official variable name or anything, just what i called the Vector2 variable for a position relative to the player position where the bat could hover before making another attack