Int variable problem

1
2
    int subimage = 0;
    int maxbimage = 7;


1
2
3
4
5
6
7
8
9
void Player::logic()
{
    subimage+=1;
    if (subimage >= maxbimage)
    {
        subimage = 0;
    }
    calc_subimage();
}


if some reason subimage continues to increase beyond 7
is there anything wrong with this code?

when it gets higher than maxbimage I want it to reset to 0
Last edited on
Post a little bit more than that; the code shown shouldn't even increase subimage beyond 1. :/ The loop and other surrounding code, at least.
Topic archived. No new replies allowed.