Driving me crazy, please help!

bladeolsonbladeolson Member Posts: 295
edited November -1 in Working with GS (Mac)
So I have come quite way with my game but an important part is driving me nuts.

I am using the accelerometer to control the left right movement of my guy. It works great. I am changing the velocity depending on which direction you move the accelerometer. My guy jumps up and as I move the accelerometer he will move in that direction, but when I switch to the othe direction he moves the other way, but it is too slow. meaning he needs to compensate for the X movement before he can begin moving the other way. Is there a way to "slam on the brakes" when I switch directions? I tried setting up some rules but was getting lost.

Any help would be appreciated.

Comments

  • synthesissynthesis Member Posts: 1,693
    have you used the change velocity behavior and set the actors velocity to 0 prior to changing directions?

    Or...
    when myGuy is "movingRight"...and I say "moveLeft":
    changeAttribute self.velocity.X = 0

    after X seconds,
    accelerate "leftAccelerationValue" in the "leftDirection"
  • bladeolsonbladeolson Member Posts: 295
    Yeah , I just tried that, and it seems to stop him dead in his tracks. I am testing it now.

    May I ask, what is the reason for the "after X seconds,accelerate "leftAccelerationValue" in the "leftDirection" " ??
  • synthesissynthesis Member Posts: 1,693
    Its a bit of a pause to allow the effect to take place and make sure the left acceleration happens AFTER the velocity is stopped fully (in case you have other routines firing off elsewhere...perhaps in other actors).

    I recommend about .25 seconds in that timer.

    If you are clever...make the pause about 1 second and insert a 1 second long animation in that time gap of the character "hitting the breaks and turning around...giving more "experience" in the game and making it a little more realistic...than just a stop. Animate that immediate momentum reversal....like a "whoooohh Crap!" looking effect.

    This logic sequence I described previously is as if you are running right and then decided to turn around and run left. If the intended sequence was to simply stop...then you don't need the timer and the reversal part....but a cool "quick stop" animation would be fun!
  • bladeolsonbladeolson Member Posts: 295
    Great ideas. it totally seems to work too by the way.

    I like the idea of adding an animation to make it look like he is slowing himself down. One thing I did that was cool instead of going to a velocity of 0 , I set it to 100, so the guy kinds of floats into a stop when jumping. it looks and feels great.
  • synthesissynthesis Member Posts: 1,693
    Excellent...Looking forward to a "free sample" down the road! :)
  • bladeolsonbladeolson Member Posts: 295
    Definitely for sure! I will hook you up.
Sign In or Register to comment.