some help on circular player movement
H All,
I have a problem. I have a planet which is completely circular and I have a player who has to be able to run around this planet. When they jump they are to be pulled down to the surface of the planet. so essentially its a platform game but running around completely circular planets.
any idea of how i would do this within mmf as going in and coding up the trig for it seems like a nightmare of epic proportions.
thanks greatly for any help.
just to recap.
player moves around the planet's circumference using the left/right arrows
pressing jump sends the player along the normalised (?) angle to the planet's surface
upon reaching the maximum jump hight the player drops back towards the planet surface.
Re: some help on circular player movement
You could do something like this:
Always
-set X position to X("planet")+(Cos(rotationValue("player")))*distanc eValue("player")
-set Y position to Y("planet")+(Sin(rotationValue("player")))*distanc eValue("player")
where rotationValue can be edited to make yor player move, use an alterable value or a counter, and distanceValue is the number of pixels away from the center of the planet.
when player holds right
-add one to rotationValue
when player holds left
-sub one from rotationValue
For moving:
rotationValue<0
-set rotationValue to 360
rotationValue>360
-set rotationValue to 0
I´m no good at custom platform movements but a basic idea for jumping(should work with pretty much any custom jump, a more dynamic one would be much better..):
start of frame (or whatever)
-set surfaceValue to a number(equal of pixels from center of planet to surface)
distanceValue < surfaceValue
-set distanceValue to value of surfaceValue
-set flag1 off
player press jump and flag1 is off
-set flag1 on
-set jumpValue to 100 (or someThing)
jumpValue > 0 and flag1 is on
-sub 1 from jumpValue
-add 1 to distanceValue
jumpValue = 0 and flag1 is on
-sub 1 from distanceValue