c++ - How do I set up an if statement to animate a sprite? -


how can set if statement after every frame sprite shows next frame , next , once goes through frames over?

i tried using if statements , has never worked me, give example?

edit:

after demand code have decided add sample.

int frame4 = 1;  if(frame4 = 1) { walkdownframe1(); //renders frame 4 } else if(frame4 = 2) { walkdownframe2(); //renders frame 2 } else if(frame4 = 3) { walkdownframe3(); //renders frame 3 } else if(frame4 = 4) { walkdownframe4(); //renders frame 4 } else if(frame4 = 5) { frame4 = 1; } frame4++; 

no matter modifications apply stays stuck on 1 frame.

i'm assuming mean if conditions true animation occurs , if conditions false stops, in case like

/*rest of model transformation code*/ if(shouldbeanimating){    /*animation code*/ }else{ /*default state or nothing if want model  freeze @ point in animation*/ } 

then whenever program should stop animation set shouldbeanimating false


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -