I am having a small problem that i am not to sure on how to fix it and i really need some help.
Problem: When pressing the space bar to slow down the cross hairs speed, it works but i can not go diagonally down to the left.
The problem did not occur the fist time i did the coding wile watching the tutorial, I did not notice it until the end of lesson 7. i don't know if the problem is in my coding therefore i think that i may have changed a setting or some thing (if that is possible). If you know what i have done can you plz tell me.
my game.cpp file/thing
void Game::ComposeFrame()
{
// movement speed
int speed;
speed = 3;
if( kbd.EnterIsPressed() )
{
speed = 8;
}
if( kbd.SpaceIsPressed() )
{
speed = 1;
}
// controlls
if( kbd.RightIsPressed() )
{
x = x + speed;
}
if( kbd.LeftIsPressed() )
{
x = x - speed;
}
if(kbd.UpIsPressed() )
{
y = y - speed;
}
if(kbd.DownIsPressed() )
{
y = y + speed;
}
// colour if in center
int r;
r = 255;
if( x > 300 && x < 500 && y > 200 && y < 400)
{
r = 0;
}
// outer boundary
if( x < 5 )
{
x = 5;
}
if( x > 794 )
{
x = 794;
}
if( y > 594 )
{
y = 594;
}
if( y < 5 )
{
y = 5;
}
// draw cross hairs
gfx.PutPixel( x, y,255,100,100 );
gfx.PutPixel( -5 + x, y,r,255,255 );
gfx.PutPixel( -4 + x, y,r,255,255 );
gfx.PutPixel( -3 + x, y,r,255,255 );
gfx.PutPixel( 3 + x, y,r,255,255 );
gfx.PutPixel( 4 + x, y,r,255,255 );
gfx.PutPixel( 5 + x, y,r,255,255 );
gfx.PutPixel( x, -5 + y,r,255,255 );
gfx.PutPixel( x, -4 + y,r,255,255 );
gfx.PutPixel( x, -3 + y,r,255,255 );
gfx.PutPixel( x, 3 + y,r,255,255 );
gfx.PutPixel( x, 4 + y,r,255,255 );
gfx.PutPixel( x, 5 + y,r,255,255 );
}
Moving cross hairs problem
Re: Moving cross hairs problem
Might be there's something wrong in your code, but a lot of the cheaper keyboard today that use usb connection can't take more than 3 key presses at a time.
Might be there's something in your keyboard preventing it from taking all these key presses at once.
Might be there's something in your keyboard preventing it from taking all these key presses at once.
ʕ •ᴥ•ʔ