Is it possible to make gravity go horizontal and also use accelerometer
StormyStudio
United KingdomMember Posts: 3,989
Good evening,
Just putting some basics together to see if my current idea is a possibility. I've set up gravity and have objects that react to it. I wanted to know if there is a way to control the direction of gravity though the accelerometer. If you don't know the full answer just a hint on how to change the direction of gravity to horizonal would be great, for games that could be used with the iphone held vertically.
Only my second day using Game Salad and it is so easy to pick up...
Cheers
Jon
Just putting some basics together to see if my current idea is a possibility. I've set up gravity and have objects that react to it. I wanted to know if there is a way to control the direction of gravity though the accelerometer. If you don't know the full answer just a hint on how to change the direction of gravity to horizonal would be great, for games that could be used with the iphone held vertically.
Only my second day using Game Salad and it is so easy to pick up...
Cheers
Jon
Comments
Currently, Gravity only works in one direction.
If you want gravity to go to the left, turn Gravity in Scene off, and apply a constant Velocity in the left direction to each affected actor in the scene.
Set it up so the keyboard keys are working for preview, but accelerometer is involved.
I possibly could of done this without the use of two extra objects...but I'm still learning.
I've managed to set it up so that I have two actors (who could be transparent), one moves left and right depending on the value of the accelerometer (if it is <-1 or >1) or keyboard press. The other moves vertically depending on the y of the accelerometer (if it is <-1 or >1).
Then my main actor (lets says its a ball for now), has a timer function going off every 0.01 seconds and is being told to move to postion x of my actor that follows the x and the position y of the actor that follows the y.
Seems to do the job.
I have a game in the works that is set to portrait (verticle), uses gravity (kind of), and uses the acelerometer. Here's how - put an acceleration (not change velocity) in any actor that you want to "fall" in my case they are falling left (so when you turn your phone they are falling down). Just set the direction of acceleration left or right depending how you want the phone to be held. Do NOT use the built in Gravity - keep it at zero. You may want to also put a max speed in the falling actors if they are going to fall for awhile as they will keep speeding up. Use the accelerometer just like the wiki says. Works fine for me.
so so so...should'nt be doing this as my wife is now in labour...but we are killing time at home waiting for the contractions to get stronger... been up since 2.30 this morning...