top of page

Main movement script

bat movement_edited.jpg

Full movement script

bat movement.png

In this game, I was tasked to create all sprites and code by myself. It is a simple shooter game with 2 different enemies and a final boss.

 

The hardest challenge faced when trying to programs this game was making the bat have a fluent yet randomised movement. 

A simple way to programs the bats would be to just change x and y in a constant movement. However, the movements of the bat would look stiff and unnatural since flying is never in a linear motion but in a constant speed up and slowdown movement. 

To try and emmulate this and make the bat look more natural. I resorted to using the sin function and use its ability to make smooth and curved movements for the bat. To do this I added a variable for both x and y respectively that would set a number and increase or decrease it depending on the bats position to the player. as the number changes inside the sin function, the sin would then translate this into a wavy motion. 

bottom of page