At the push of a certain button within my game, my character changes its animation frame, I do this by using the 'choose' function. Sometimes it will choose the same frame that is already on screen. How do I make it that it never chooses the same, always a different frame?
Develop games in your browser. Powerful, performant & highly capable.
Can you try when pressing a certain button add action of set frame to: random(0,1, 2, 3) or whatever number of frames you have? Instead of commas, does Construct allow hyphens (0-4)?
This should work:
+ Touch: On any touch start | Local static number tempRandom = 0 ----+ System: While ----+ System: tempRandom = Sprite.AnimationFrame -----> System: Set tempRandom to int( random(Sprite.AnimationFrameCount)) ----+ System: [X] tempRandom = Sprite.AnimationFrame -----> Sprite: Set animation frame to tempRandom
It's also a little more flexible than specifying the available animation frames.
Try this:
Sprite: Set Animation Frame to:
abs(Sprite.AnimationFrame - int(random(1,Sprite.AnimationFrameCount-1)))