Movement with inertia

SparkyidrSparkyidr Member Posts: 2,033
edited November -1 in Working with GS (Mac)
Hiya. I'm new here.
Just started playing with game salad after moving from multimedia fusion, and am struggling with something that mmf seems to do automatically.......here is my question.

Is there a fairly easy way to make a player controlled actor move with a feeling of inertia.
(The normal "move" behaviour is a little stiff feeling)
So.....Here is what I have done so far.

rather than setting up "move" for each for my 4 directions, I set up "accelerate" and set it to something like 1000 speed. this gives me a pretty instant move start, but feels pretty smooth.

Now the hard part, I obviously want it to stop when I let go of the key-press, but I'm unsure how to make it do it.

I have tried adding the "drag" to my list of behaviours for the actor, and set it to something like 600 which gives a fairly nice feel again.
But I don't really like this, as the drag also affects the start up of the movement as well as the stopping, and also, when I let go of my movement key, the actor still moves a tiny little bit, t's not totally stopped.

Am I over-thinking this, and there is a much simpler way? Or am I on the right track, but just have something wrong?

Ta

Sparky.

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hey,

    You could try these:

    1. You can try wrapping the accelerate behavior in a timer:
    set the timer to FOR (a brief amount of time) to give sort of a "burst" feeling.

    2. Instead of drag, I would try increasing the friction to almost match the density.

    3. To be honest, unless you're using the accelerometers to control movement, I would go back to using the Move Behavior. I understand what you're saying about the stiffness, but be aware that the iPhone and iTouch are way less responsive that the preview player or web player. You'll want to squeeze out as much responsiveness from them as you can.

    just my $.02
    Joe
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    do you want it to stop instantly? just put a rule that when that key is not pressed, change velocity to 0. That should work, i think.
  • SparkyidrSparkyidr Member Posts: 2,033
    Thanks guys.
    Basically, I want it to start up seemingly immediately, but have a slight slowing effect for a fraction of a sec or so till it stops, rather than a "bang" stop effect. Just so it smoothes out the movement a little.

    The accelerate/drag setup I have at the mo is pretty much doing the job as I want it, but my player is never fully stopped, there is always some slight movement when I am off the key presses.

    Ideally I guess I need it to move immediately as I press the key, and have a really quick deceleration effect as I let go of the key if that makes sense.

    I'm just being a picky designer type, and want my movement smoothed out :o) heh.

    Sparks.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    that's cool.

    you could clamp it down with a rule that says

    When self.LinearX < (some small amount)
    self.linearX = 0;
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    did you try something like this?

    when key is pressed
    accelerate to 1000

    when key is released
    accelerate to 0

    something like that should work, right? I didn't actually test it out
  • SparkyidrSparkyidr Member Posts: 2,033
    yeah Mulcahy... I think that was the first thing I tried. (seemed pretty logical) Doesn't do anything, the player just keeps going. :o)
    I also tried setting the acceleration to a negative number, but that just sends it flying off in the opposite direction.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    you could try monkeying with the friction.
    try setting it close to or equal to the density of your actor
  • SparkyidrSparkyidr Member Posts: 2,033
    Yeah. Seems like one of those things that will happen with a bit of trial and error. Like I said earlier, the accelerate/drag thing seems to be working ok(ish) for just messing around making a simple game to test out how easy gs is for me to use.

    going to add a bit of music to what I have knocked up and get it shared later on (be gentle with me if you wanna give feedback once it's up) ;)
  • SparkyidrSparkyidr Member Posts: 2,033
    here it is :
    http://gamesalad.com/game/play/30440

    Obviously, not meant to be a full featured game, but just me testing out gamesalad as a tool.

    enjoy
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hey,

    I like it! It does have a nice feel. I appreciate the subtlety.
    Do you have a license?
    If so, you should try to hook that up to the accelerometers!
  • SparkyidrSparkyidr Member Posts: 2,033
    no just got the free one the other day.

    quick question about the viewer for the iphone...
    the mac isn't the computer I have my phone sync'd to. is that going to be an issue? Either with GS, or further down the line with any Apple stuff?
Sign In or Register to comment.