• entries
198
445
• views
83793

# ## Let me present to you, a problem.

134 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!

I'm gonna sue you for \$500,000,000.01 for unauthorised use of my name in your journal.

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

This post officially gets the Rob Loach's Journal Post of the Momment Award.

What is a momment?

It's like a moment, but longer [grin]

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.