samedi 27 février 2016

if statement not resolving despite condition being met C++

I'm working on a university assignment wherein I have to re-create the classic Frogger game. Having trouble with tyre movement.

for (int tZ = 0; tZ < kTyreColumnLength; tZ++)
{
    for (int tX = 0; tX < kTyreRowLength; tX++)
    {
        eachTyre = tX + tZ;
        tyre[eachTyre] = tyreMesh->CreateModel(0, -2.50, 0);
        tyre[eachTyre]->Scale(10);
        tyre[eachTyre]->SetX(tyreXs[tX]);
        tyre[eachTyre]->SetZ(tyreZs[tZ]);

        if (tZ % 2 == 0)
        {
            tyreMovingLeft[eachTyre];
        }
    }

}

Basically, the way I'm drawing my tyres is through nested for loops. The inner loop draws3 tyres, and is repeated for each row (outer loop)

I'm then trying to assign each "even" row tyre, a Boolean to track its direction.

tZ % 2 ==0 IS correctly resolving to true/false each time the outer loop iterates, the debugger says the condition IS being met, but it's just never executing.

Aucun commentaire:

Enregistrer un commentaire