beginner tutorial 8 ,poo game
Posted: February 19th, 2018, 7:11 pm
Code: Select all
void Game::UpdateModel()
{
if (wnd.kbd.KeyIsPressed(VK_RIGHT))
{
dudeX = dudeX + 1;
}
if (wnd.kbd.KeyIsPressed(VK_LEFT))
{
dudeX = dudeX - 1;
}
if (wnd.kbd.KeyIsPressed(VK_UP))
{
dudeY = dudeY - 1;
}
if (wnd.kbd.KeyIsPressed(VK_DOWN))
{
dudeY = dudeY + 1;
}
//why these two lines don't clamp if i put in the
//beginning of update model? and works fine and dandy after the if statements??
dudeX = ClampScreenX(dudeX, dudeWidth);
dudeY = ClampScreenY(dudeY, dudeHeight);
}