tutorial 8 homework(BEGINNER)
Posted: February 24th, 2018, 3:20 pm
https://www.youtube.com/watch?v=KIw8MX7 ... BHBFFRVWsx
in the video 2:45
poo0X += poo0vx;
poo0Y += poo0vy;
poo1X += poo1vx;
poo1Y += poo1vy;
poo2X += poo2vx;
poo2Y += poo2vy;
{
const int poo0xold = poo0X;
const int poo0yold = poo0Y;
poo0X = ClampScreenX(poo0X, poowidth);
poo0Y = ClampScreenY(poo0Y, pooheight);
if(poo0X != poo0xold)
{
poo0vx = -poo0vx;
}
if (poo0Y != poo0yold)
{
poo0vy = -poo0vy;
}
I have highlighted my doubt in red, we set poo0old to poo0X, why after clamping the position of the poo changes? I mean how poo after clamping is different than the poo before clamping. both the variables have to be same all the time right. This is the part i don't understand. Hope anyone in this wonderful community could enlighten this poor boi.
in the video 2:45
poo0X += poo0vx;
poo0Y += poo0vy;
poo1X += poo1vx;
poo1Y += poo1vy;
poo2X += poo2vx;
poo2Y += poo2vy;
{
const int poo0xold = poo0X;
const int poo0yold = poo0Y;
poo0X = ClampScreenX(poo0X, poowidth);
poo0Y = ClampScreenY(poo0Y, pooheight);
if(poo0X != poo0xold)
{
poo0vx = -poo0vx;
}
if (poo0Y != poo0yold)
{
poo0vy = -poo0vy;
}
I have highlighted my doubt in red, we set poo0old to poo0X, why after clamping the position of the poo changes? I mean how poo after clamping is different than the poo before clamping. both the variables have to be same all the time right. This is the part i don't understand. Hope anyone in this wonderful community could enlighten this poor boi.