I am developing a program where a square moves from side to using a timer in OpenGL. It just goes to one side and stops completely still...
I have made a cube in a function called enemy...
Next I have timer called Timer and this is what it does:
void Timer(int value)
{
if (value == 1 && xa < 16 && b == 5)
{
xa = xa + 0.1;
xTwoa = xTwoa + 0.1;
xThreea = xThreea + 0.1;
xFoura = xFoura + 0.1;
}
else if (value == 1 && xa > -500 && b == 4)
{
xa = xa - 0.1;
xTwoa = xTwoa - 0.1;
xThreea = xThreea - 0.1;
xFoura = xFoura - 0.1;
}
if (xa == 16)
{
b = 4;
}
else if (xFoura == -500)
{
b = 5;
}
I am starting to make a video game and value is what level it is supposed to be.
The variable b is used to determine what side of the window it is on so it does not keep fidgeting between pixel 15.9 and 16. Need someone's advice on the matter... Will not move from side to side it just stops on right side!