Sign in to follow this  
  • entries
    198
  • comments
    445
  • views
    82912

## Let me present to you, a problem.

Sign in to follow this  
Laz

111 views

This post has won the Rob Loach's Journal Post of the Momment Award! GO ME!

A few things. First off, retard.

Second, mith posted this in pouya's journal. It made me go lol.

Last, I did some work on Lazteroids 2. I'm stuck trying to get thrust working on my ship (No, Pouya, I'm not trying to thrust my ship). Simple concept, I know, but it's giving me one hell of a headache. I finally got it working, but it's kind of hacked in. Here is the code, and if anyone can PLEASE give me some cleaner method of doing it, It'd be much appreciated.

if (input->KeyDown(VK_UP) || input->KeyDown('W')) {
fVelocity.x += matrix.GetY().x * fSpeed * fTime;
fVelocity.y += matrix.GetY().y * fSpeed * fTime;
}

if (fVelocity.x < 0) {
fVelocity.x += (fSpeed / 8) * fTime;

if (fVelocity.x > 0)
fVelocity.x = 0;
} else {
fVelocity.x -= (fSpeed / 8) * fTime;

if (fVelocity.x < 0)
fVelocity.x = 0;
}

if (fVelocity.y < 0) {
fVelocity.y += (fSpeed / 8) * fTime;

if (fVelocity.y > 0)
fVelocity.y = 0;
} else {
fVelocity.y -= (fSpeed / 8) * fTime;

if (fVelocity.y < 0)
fVelocity.y = 0;
}

matrix.Translate(fVelocity);



Meh. I suck at life. GAME OVER!
Sign in to follow this  


5 Comments


Recommended Comments

Yo skillet style holmes, quit messing around with components of your vectors. vector.scale( scalar ) is your friend.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now