A Beginning and Movement with Math

Our team have choosen to work on the concept “Colossus Core” made by another team where you explore caves on a foreign planet with dangerous enemies that you have to fight with your special made hovercraft.

As the week has past we have had alot of technical problems and a slow start but now as time getting close to the deadline for our Alpha everyone have started to pull their o own weight and we are now racing to finish our every aspect that is needed for our Alpha in time.

But now that the forth week has began i have started experimenting on  our entities movement issues in our game, i started with our Player Avatar which i realized had very boring feeling movements after prototyping it’s movement felt way to strict so i made it more fluent by using easy mathematical calculations.Movement.gif

To make our Avatar to move where he is “looking” i used the angle and to calculate it i used (PI/180) * Avatars rotation and then 0.01*cos(angle) for x and 0.01*sin(angle) for y. By doing this i was now able to change our controls to move the ship forward and in reverse by pressing W and S. Then i changed A and D so you are able to rotate the ship in the direction you wish to go.

But what problems have given me the biggest amount of headache would be to get our ships missile to fly from our ship towards the position you click at with the mouse. I finally i got help from a friend with the calculations to move the missile and used the calclutation to move the missiles sprite from point A to point B.

angle = atan2(player position y – enemy globalbounds height / 2) – enemy position y and (player position x – enemy globalbounds width /2) – enemy position x then inside the move function for my enemy sprite i put in the cos(angle) * the movementspeed i decided in the x and sin(angle) * the movementspeed in y.

To finish this weeks work with movements i fixed the attack of one our monster to move towards our player which is one of the easier monster patterns to face in our game to program this i decided to mirror my movement for the missile and only change the parameters.

I have no finished with movement calculations for the moment and will  now close of this week off.

 

 

About Christoffer Lövdahl

2015 Game Design