Adding Physics to our Game


Author: Alejandro Morales


During this week in Luddite, I had to implement a bit of physics for some enemy behaviors and attacks. The reason is that there is an enemy that will jump over the player to try to get behind him and one of the enemy's attacks shoots a projectile at the player for an AOE attack. My first big problem was getting the velocity of the projectile, I had the locations of both start and end but getting the actual arch of the projectile was going to be tricky.  After some research and looking around we found a variety of formulas that fit our criteria.


We started off just getting the magnitude and direction of the vector simply by subtracting the player's location with the enemy's location, then we divide that by time. Then we got time over to and multiply that by gravity now we subtract that by the first vector and we get the velocity needed for our projectile. With this formula, many of the difficult parts like the direction are handled by it and time is simply the amount wanted for the projectile to reach its destination. This formula can also be implemented for other things like our jumping enemies 


Leave a comment

Log in with itch.io to leave a comment.