Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    198
  • comments
    445
  • views
    83460

## Let me present to you, a problem.

Sign in to follow this  
Laz

121 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

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

Share this comment


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

Share this comment


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

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
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!