###

» Thu Feb 06, 2014 7:35 pm

Hello everyone,

I have quite a problem I have been working on for the last few days. In a nut shell, I have a game where gravity changes (is constantly changing. I am using physics behaviors on all objects.

Basically, at the beginning of the event sheet, I determine need to determine what surfaces the player is touching (up,down,left,right) and what directions the player is moving relative to the force of gravity (up,down,left,right)

I have solved how to determine collision surfaces and what side they are on. I also feel like I know how to solve the other problem.

my events look like this:

-----

//finding the angle the player is moving and the distance traveled

player travel angle = system angle(oldx,oldY, currentX,currentY)

player travel distance = system distance(old vector, new vector)

//checking if player is moving "up"(given gravity can be at any angle and up is the way gravity is not pulling)

if travel distance is greater than 0 (make sure the player is moving)

and if the smallest difference between the angle of gravity and the players travel angle is greater than 90.

-------

I wouldn't mind being able to check what the distance traveled along the arbitrary axis of gravity would be either, but I can't seem to figure out how to calculate that. Normally if gravity is down it is easy to see how far along each axis an object has traveled because the angle of gravity is aligned with x and y (therefore if y distance is less than 0 it follows that the player is moving in an upward direction)

Anyway if anyone is familiar with this stuff let me know. I can't share the capx due to nondisclosure stuff.

thanks