- Game.cpp
- (4.38 KiB) Downloaded 160 times
getting cryptic compilers errors
getting cryptic compilers errors
I'm getting cryptic compilers errors which I'm not sure what they mean
- AleksiyCODE
- Posts: 32
- Joined: September 21st, 2019, 8:47 pm
Re: getting cryptic compilers errors
This .cpp file can't be compiled by itself, so i cant see the error you are having. Either Send a screenshot of the error or all .cpp and .h files that you have in the project.
I like ass
Re: getting cryptic compilers errors
ok here it is.
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: getting cryptic compilers errors
Code: Select all
x = x + vx;
y = y + vy;
if (x + 5 >= gfx.ScreenWidth)
{
x = gfx.ScreenWidth - 6;
vx = 0;
}
if (x - 5 < 0)
{
x = 5;
vx = 0;
}
if (y + 5 >= gfx.ScreenHeight)
{
y = gfx.ScreenHeight - 6;
vy = 0;
}
if (y - 5 < 0)
{
y = 5;
vy = 0;
}
shapeIsChanged = false;
if (!(x > 200 && x < 300))
{
shapeIsChanged = true;
}
if (wnd.kbd.KeyIsPressed(VK_CONTROL))
{
gb = 0;
}
Your code:
Code: Select all
void Game::UpdateModel()
{
/***
* Errata:
* In Part 3 when we make the gb variable a membeddddr variable,
* it will maintain its value from frame to frame.
* So if we don't reset it every frame, then the first time we press CTRL and set it to 0,
* it will forever after be stuck at 0, which is probably not desired behavior. ;)
***/
gb = 255; //reset gb every frame
if (wnd.kbd.KeyIsPressed(VK_RIGHT))
{
if (inhibitRight)
{
}
else
{
vx = vx + 1;
inhibitRight = true;
}
}
else
{
inhibitRight = false;
}
if (wnd.kbd.KeyIsPressed(VK_LEFT))
{
if (inhibitLeft)
{
}
else
{
vx = vx - 1;
inhibitLeft = true;
}
}
else
{
inhibitLeft = false;
}
if (wnd.kbd.KeyIsPressed(VK_DOWN))
{
if (inhibitDown)
{
}
else
{
vy = vy + 1;
inhibitDown = true;
}
}
else
{
inhibitDown = false;
}
if (wnd.kbd.KeyIsPressed(VK_UP))
{
if (inhibitUp)
{
}
else
{
vy = vy - 1;
inhibitUp = true;
}
}
else
{
inhibitUp = false;
}
} // <--- FALSE END OF FUNCTION
x = x + vx;
y = y + vy;
if (x + 5 >= gfx.ScreenWidth)
{
x = gfx.ScreenWidth - 6;
vx = 0;
}
if (x - 5 < 0)
{
x = 5;
vx = 0;
}
if (y + 5 >= gfx.ScreenHeight)
{
y = gfx.ScreenHeight - 6;
vy = 0;
}
if (y - 5 < 0)
{
y = 5;
vy = 0;
}
shapeIsChanged = false;
if (!(x > 200 && x < 300))
{
shapeIsChanged = true;
}
if (wnd.kbd.KeyIsPressed(VK_CONTROL))
{
gb = 0;
}
} // <--- TRUE END OF FUNCTION
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