### Author Topic: Basic movement question.  (Read 1460 times)

#### test84

• Key Contributor
• Posts: 1328
• Karma: +0/-0
• ت
##### Basic movement question.
« on: Wed, Aug 15, 2012 »
Hi,

I've done a game with flixel but am not confident enough about how things move around in it because I can get same effect with different combinations of velocity, acceleration and maxVelocity.

So basically I'm eager to know what is the "proper" way (read that with a British accent, lol) to do movement in both X and Y axises.

I can either give a FlxSprite a negative value for velocity.y but I know I can get the same effect with setting negative value for acceleration.y. I know and I think that's because of how things work with basic Newton moves and probably they have been done in the same way in flixel but I'm asking anyway.

Thanks.
blog, twitter, Check out my award winning game, Rot Gut:

#### auriplane

• Snails!!
• Contributor
• Posts: 497
• Karma: +1/-0
• Snails!!
##### Re: Basic movement question.
« Reply #1 on: Fri, Aug 17, 2012 »
The question is ill-specified.  Like with many things, there is no proper way.

You need to specify your question in terms of behavior.  Figure out what behavior you want, then decide how to implement it.  If you don't know what behavior you want, experiment with implementations until you find a behavior you like, or observe the behaviors in games you find interesting.  You'll notice that different games implement different behaviors, and no one behavior is more "proper".

#### Raf

• Contributor
• Posts: 268
• Karma: +0/-0
##### Re: Basic movement question.
« Reply #2 on: Mon, Aug 20, 2012 »
Purely based on linguistics (and by someone of whom English is his third language, so I can be wrong in this), I'd say there's a huge difference:

Acceleration is by how much velocity in / decreases.

So setting acceleration to a different value would mean that velocity increases by that amount. Setting acceleration to a negative number thus means velocity becomes more and more negative.

That is how it would work, according to my understanding of linguistics. I've had trouble verifying this in Flixel as well, so am also quite interested in knowing whether that's how Flixel does this, or not.

#### test84

• Key Contributor
• Posts: 1328
• Karma: +0/-0
• ت
##### Re: Basic movement question.
« Reply #3 on: Mon, Aug 20, 2012 »
Thanks I think your second paragraph is what it is.
blog, twitter, Check out my award winning game, Rot Gut:

#### Cowbacca

• Active Member
• Posts: 107
• Karma: +0/-0
##### Re: Basic movement question.
« Reply #4 on: Mon, Aug 20, 2012 »
In terms of physics, giving it an acceleration would be the 'proper' thing to do.  In the real world, things don't just suddenly gain velocity, they are acted upon by a force, which gives them acceleration.  The acceleration then affects the velocity.  Manipulating accelerations rather than velocities would be more realistic, but not necessarily easier or better.

#### test84

• Key Contributor
• Posts: 1328
• Karma: +0/-0
• ت
##### Re: Basic movement question.
« Reply #5 on: Mon, Aug 20, 2012 »
In terms of physics, giving it an acceleration would be the 'proper' thing to do.  In the real world, things don't just suddenly gain velocity, they are acted upon by a force, which gives them acceleration.  The acceleration then affects the velocity.  Manipulating accelerations rather than velocities would be more realistic, but not necessarily easier or better.

Thanks for the explanation. What about in case of flixel?
blog, twitter, Check out my award winning game, Rot Gut:

#### ETG

• Active Member
• Posts: 115
• Karma: +0/-0
##### Re: Basic movement question.
« Reply #6 on: Tue, Aug 21, 2012 »
Whatever feels right. Real life physics tend to be boring in games.

A few thing to consider:

How quickly does the player respond to input. This can be affected by things like taking too much time to accelerate or long windups in attack animations.

The precession of the controls. How easy is it for the player to position the character where he wants it? Is the character so quick that milliseconds different in player input create so different outputs that failing or succeeding seems almost random. Can the player interrupt actions with other actions, or do you want to buffer actions so the game doesn't seem to miss or ignore inputs? Maybe it's important to have the player need good timing, accurate motions, and careful planning.

Characters reaction to input.  Sometimes a useless duck or pointless looking up animation can add to the immersion by responding to the player more.

Small details that can enhance the feel. Good sound effects always enhance the experience. Adding a small puff of dust when you land can make the controls feel more solid. Animations for transitioning from state to state can, if done right, make the controls feel more fluid. Done wrong and the controls will feel sluggish.

Try to have in mind how you want the control experience to feel before you start. Then do what you can and try to figure out the difference between what you have and what you want. If you don't know what specific changes need to be made, then at least try to get a general idea first.