Multiple sources of gravity?
covcomm
Member Posts: 3
Hi,
I'm new here so bear with me if someone suggested this before...
I was wondering if it's possible to create actors with there own gravity, so in addition to the main scene gravity, a player can jump from platform to platform and walk underneath a floating platform, but if they jump too far, they fall all the way to the bottom of the level.
Of course this would go hand in hand with been able to use the accelerometer to change the games orientation from landscape to portrait (is this possible with gamesalad?) and being able to move the scenes gravity from down to up or anywhere you want it to go.
I think an 'attractor' is what I'm after.
I'm new here so bear with me if someone suggested this before...
I was wondering if it's possible to create actors with there own gravity, so in addition to the main scene gravity, a player can jump from platform to platform and walk underneath a floating platform, but if they jump too far, they fall all the way to the bottom of the level.
Of course this would go hand in hand with been able to use the accelerometer to change the games orientation from landscape to portrait (is this possible with gamesalad?) and being able to move the scenes gravity from down to up or anywhere you want it to go.
I think an 'attractor' is what I'm after.
Comments
So lets say you wanted it to depend on the orientation of the iphone. Do just like above but create an invisible actor instead of the planet. Same rules but make it invisible and put in the accelerometer rules as outlined in the wiki. Then when you tilt the phone objects will fall towards the tipping phone.
First, the planet actors gravity for some reason isn't attracting my 'creature' actor, the creature goes straight upward!
Second, if I temporarily remove the planet from my scene, my creature goes straight up again!
Not exactly what I'm looking for but, at least this is a great way to get game gravity to move in the opposite direction.
Here's what I got:
Game attributes:
planetX (integer)
planetY (integer)
Scene attributes:
gravity = 0
Planet attributes (prototype):
Constrain Attribute game.planetX to self.positionX
Constrain Attribute game.planetY to self.positionY
Creature attributes (prototype) :
GravityDirection (angle)
Constrain Attribute: self.Gravity.Direction to vectorToangle( self.positionX - game.planetX, self.positionY - game.planetY)
Accelerate:
Direction: self.GravityDirection Relative to: actor
acceleration: 100
I think that's what you mentioned above, but it didn't work as planned.
So my question is, how do make the planet the center of gravity, so that the creature falls to toward it?
That way you don't need to use vectorToAngle.