Accelerometer and Jumping

ok this is causing me ALOT of pain

Basically I want to use the accelerometer to control my player in a 2d platform style game but he also needs to be able to jump (best example I can find is "The Incident" by the Big Bucket Software (on iTunes store)

Couple of things:
1. I found an amazing template which has the smoothest accelerometer transition I have seen via the forums. It uses Move behavior and has the following "low pass filter" to control the player and works great.

( game.Accelerometer.Y *.04)+( self.tiltOutput *.96)


2. I know how to make an actor jump using Motion.Linear.Vel.Y and putting some gravity on the scene


However as soon as I combine the 2 everything goes to crap.. as far as I can tell the move behaviour stops the Motion.Linear.Vel.Y from working properly and it makes gravity slow down so the player falls back to the ground very slow. To get around this I have to turn the gravity up to like 5000 but this then affects everything else in my scene.


Can anyone help me with this, recommend a better way or point me to an "The Incident" style template?

Thanks

Comments

  • RoksaltRoksalt Member Posts: 87
    Bump - sorry I'm really stuck on this!
  • FlamingbananaFlamingbanana Member, PRO Posts: 90
    Well I wouldn't use gravity in a situation like this. You should probably use a downward velocity on you actor/character. So just put a change velocity behavior with an angle of 270 and you can play with the speed to get it how you like. See if that changes anything :)

    -Tad
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    You didn't supply quite enough information to be able to help with your particular situation. However, here is a demo that shows how to do a tilt/jump combo that doesn't interfere with game physics. (In fact it uses physics to achieve the smooth accelerometer effect you want.)

    http://www.mediafire.com/download.php?lyb9ezhdl8by3n1
  • RoksaltRoksalt Member Posts: 87
    Thanks for the replies. The demo you provided is pretty good however there is still a couple of issues.

    @Flaming Banana I agree that gravity isn't a good idea so I will use change Velocity

    @RThurman After playing around with the numbers for a while I have it to a point where its acceptable (although not awesome like "The Incident", as its no where near as responsive). Any ideas on how to improve this?

    Also if I was to add a platform for the player to jump on to then things go weird again. Basically it seems that when the player is already leaning up against the platform (with the device already angled left or right) then the change velocity doesn't work properly... How do I fix this?

    (BTW Sorry if that doesn't make sense I have attached my sample project below as its probably easier to just look at that and see what I mean.)

    http://bit.ly/ZMGr0r

    Cheers in advance :-)
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @Roksalt -- Don't know what you mean by "no where near as responsive". I would need more detail than that.

    There is a max speed that is set. Do you need to increase that?

    To get a better jump, you should probably try setting friction to 0 in both actor prototypes.

    Maybe by playing with a combination of max speed and friction, you will get something that is as "responsive" you want.

    Also, some responsiveness has been designed out of it. For example, the jump is restriced so that it does not follow the tilt of the device. Perhaps you want it to tilt in mid-air.
  • RoksaltRoksalt Member Posts: 87
    yeah I will play around with those attributes and see how it feels.

    How would I make it so the tilt works in the air?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @Roksalt -- to get tilt working (in the air), remove the condition that says:

    (Actor receives event) (overlaps or collides) with (actor of type) (base/walls)
  • RoksaltRoksalt Member Posts: 87
    Cheers. I will try it and let you know.
  • RoksaltRoksalt Member Posts: 87
    BTW @RThurman your help on this question:

    http://forums.gamesalad.com/discussion/53410

    Is actually the perfect solution.. Cheers!
Sign In or Register to comment.