Tiny bat(man)


A final foe

A bit less time this week and have not managed to fully finish the last foe for the game. Or rather last planned for now, might add more later as the project progresses.

This foe is a small bat that hangs in the ceilings. Chilling, looking around and in general having a good time. If a target gets near, the bat will notice and start to look at it. If the target is close enough, the bat starts flying and chase the target. If the target is out of sight, it will keep going towards the last known position. It can then continue in the last known direction, until finally giving up, if the target has not been found again.

idling.gif
Pretty fly for a bat guy

Next week the bat will also get an attack state, a death state and a re-settle state where it goes back to hanging in a ceiling after a hunt.

Behind the scenes

The bat is quite simple. Currently only consists of four frames that are used for idle, notice and hunting (flying) animation. When idling and noticing, it shows frames randomly and at varied intervals. When flying it loops the frames and at a much faster rate and is also using a tween on the animation. The tween skews the animation, creating a slight distortion that moves back and forth with random intervals and values. This adds a bit more of a movement impression to the animation.

bat.png
Four frames of bat animation


To find a target the bat uses a large collider. When an object intersects with the collider, the bat casts a ray and if there is no object between the bat and target, it starts tracking the target. When target is close enough, it uses a continous ray to know the position it wants to fly to. When moving additional forces are used to create an erattic movement, trying to resemble a bit of a frantic bat.

edito2r.png
Editor setup, bound is used notice collider intersections to avoid when navigating


Ending with a look at the ingame behaviour of the bat starting to chase the player and navigating to find the player again after loosing sight of the player.

hunting.gif
Player too close, bat starts chasing and can navigate and track target


The bat can be tested at spelmakare.se. Use the green debug menu while playing a level, to navigate to the last level where the bat can be tested.

Thanks for reading!

Leave a comment

Log in with itch.io to leave a comment.