ActionScript Man to the rescue!

6 09 2010

Longest between updates but with deadlines, clients and a sick three and a half year old I just didn’t have the time to write anything. In fact, I don’t really have the time much now, the water is boiling for another cup of tea so I’ll sneak in a few words.

Like I’ve said, it has been somewhat of a hectic week. I’ve stepped away from my normal den of C++ and OpenGL and rolled into the smooth plains of ActionScript 3.0; a language I’m assured is much better than ActionScript 2.0. I haven’t developed on the Flash platform before and so I’ve no claims to the veracity of that statement but so far it’s been a very pleasurable journey.

I’m working on a one player, one level, simple yet fun [hopefully] platformer. The goals of which can be summed up as Run, Jump, Avoid and Collect. My biggest dilema so far has been whether to incorporate complex physics, no physics or simple physics for the main character’s movement.

Having little time and not enough familiarity with the the language I’ve decided against a complex system [which includes other people’s compex systems]. No physics at all seems a bit extreme so I’ve settled on a simple acceleration vs. friction mechanic.

if (mMoving)
{
  mVelocity.x += (mAcceleration.x * mFaceDirection) * dt;
  if (mVelocity.x>mVelocityMax.x) mVelocity.x=mVelocityMax.x;
}
else
{
  mVelocity.x += (mFriction.x * -mFaceDirection) * dt;
  if (Math.abs(mVelocity.x)-EpsilonValue < 0.0) mVelocity.x=0;
}

Fake high school physics for fun and profit. The interesting part of it is that it allows different ground tiles [upon collision] to supply modifiers for any and all of these values, resulting in a more modular game world.

Another problem I came up with was the situation where players push left and right at the same time. I’ve played around with a few solutions but none of them made me happy so I’ve made the left and right button checks mutually exculsive [that is, if you’re pushing left it won’t check for right and vice-versa]. What would you do in this situation?

Well, the dishes are done but the tea has boiled and my little one is up with a soft sort of smile so I’ll leave this post as short as it is; till next time…

“Julia dream, dreamboat queen, queen of all my dreams”

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: