I have a bug that makes NO sense to me.. help!!
I have a bug that makes NO sense to me.. help!!
i was messing around with c++ and rebuilding from memory stuff i learned in early TUTs and i have come across a bug that makes zero sense to me. I made the little face, that goes around the screen and when you push spacebar he speeds up. Now here is the part that makes no sense. moving him around the screen with the arrow keys works fine, and when i hit the spacebar he speeds up and works fine unless im going up and to the left. when i go up and to the left and speed up it doesn't move any faster and i get a beeping sound. if anyone can tell me wtf is going on here i will give them 1 million dollars.
- Attachments
-
- New folder (2).rar
- (6.11 MiB) Downloaded 191 times
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: I have a bug that makes NO sense to me.. help!!
In Game.cpp file.
I think the kbd.SpaceIsPressed(true); part should be
not sure how pressing the spacebar speeds up the face in your code the speed variable isn't increased at all in your code. After changing to the above code it works for me.
Code: Select all
void Game::ComposeFrame()
{
int speed;
speed = 2;
kbd.SpaceIsPressed(true);
if(kbd.UpIsPressed())
{
y = y - speed;
}
if(kbd.DownIsPressed())
{
y = y + speed;
}
if(kbd.RightIsPressed())
{
x = x + speed;
}
if(kbd.LeftIsPressed())
{
x = x - speed;
}
if( x < 1 )
{
x = 1;
}
if( x > 780 )
{
x = 780;
}
if( y < 1 )
{
y = 1;
}
if(y > 580 )
{
y = 580;
}
Game::Position(x ,y );
}
Code: Select all
if(kbd.SpaceIsPressed())
{
speed += 5;
}
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: I have a bug that makes NO sense to me.. help!!
oh ya haha oops. i uploaded the wrong one. the one with the spacebar speeding up the face was a different one. and it wasn't a bug in the program i wrote its something else. at first i thought i fucked something up, but it happens with every program i write. if i press up, left, and spacebar all at the same time the spacebar doesn't do anyting and it makes a beep beep beep sound... totally weird.
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: I have a bug that makes NO sense to me.. help!!
Not sure, but I have had that happen on some computers where the third button regardless of which it was would not register. The beeps also sometimes happen when the message queue is full. Try it when your computer is restarting just press a button a bunch of times while it is showing the BIOS screen after awhile it beeps at you until it has cleared the message queue.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: I have a bug that makes NO sense to me.. help!!
This may be caused by Keyboard Ghosting
Musi
There are 10 types of people that understand binary.
Those that do, and those that don't.
There are 10 types of people that understand binary.
Those that do, and those that don't.