Is it possible to make gravity go horizontal and also use accelerometer

StormyStudioStormyStudio United KingdomMember Posts: 3,989
edited November -1 in Working with GS (Mac)
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

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hey,

    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.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    cool....cheers for the info....
  • firemaplegamesfiremaplegames Member Posts: 3,211
    yes, that's true. :~)
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    ok...is there a way to tell the velocity of an actor to change in direction due to changes in the accelormeter. I guess it would need a bit of thinking about, so that the changes in the x y and z of the accelerometer can be turned into a 360 degree number for the actor.?????
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    ok sort of answering my own question, but please anyone do chip in.

    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.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Have you looked at the accelerometer section of the wiki? Also search the forum for accelerometer.

    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.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Scitunes....thanks for the reply. Have looked through the wiki and picked up some more details, I'd read it before I started working in Game Salad but it makes more sense the second time round...

    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...
Sign In or Register to comment.