i'm creating game flappy bird bird flaps wings when screen touched, i'm having problem activating animation when screen touched.
batch.draw(animation.getkeyframe(mytimestate, false), x, y); //the mytimestate 0 render 1st frame only.
then when screen touched this:
//mytimestep controllable timestate animation if(gdx.input.justtouched){ mytimestate = timestate; }else if(gdx.input.justtouched == false && animation.isanimationfinished(timestate)){ mytimestate = 0; }
i don't think animation able play frames because mytimestep become 0 after finishing touch screen. don't think right way of doing it, if guys have better ideas or solution please help. in advance.
there several ways achieve this. you'll need increment timestate, of course, , depends how long animation , if want loop.
if you've created animation play once, , stop (until screen touched again), set mytimestate 0 when screen touched, , increment every frame. animation run through , "stop" on own when reaches end (as said no loop). next time touches screen, mytimestate set 0 , animation starts again.
Comments
Post a Comment