Movement with inertia
Sparkyidr
Member Posts: 2,033
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.
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
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
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
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 ) heh.
Sparks.
you could clamp it down with a rule that says
When self.LinearX < (some small amount)
self.linearX = 0;
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
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I also tried setting the acceleration to a negative number, but that just sends it flying off in the opposite direction.
try setting it close to or equal to the density of your actor
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)
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
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!
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?