Diddy and SetFrame

Monkey Forums/Monkey Programming/Diddy and SetFrame

hobo(Posted 2012) [#1]
Hello,

I'm trying to work out how I know an animation using Setframe has finished it's loop so I can move on to my next game state.

Its probably something really obvious if anyone can explain what i'm missing please let me know.

Some pseudocode below. Essentially after my setFrame animation loop has finished in gameState 2 I then want to move to gameState 3.

However i'm not sure how I know the animation is complete?

Thanks

Function Animation()

   Select(gameState)

	Case 1
           
           'Start the animation
           localcard.UpdateAnimation()
           localcard.SetFrame(0, 12, 10, False, False)
           gameState = 2
       
        Case 2
           
          'Continue animating
           localcard.UpdateAnimation()
           
        Case 3
           
          'Finished the animation

   End Select

End Function



hobo(Posted 2012) [#2]
I figured it out.

Just ask what frame the animation is on:

If (localcard.frame = 12) move on


Once it's reached 12 in this case, the game state move on.

Sorted. I'm a total beginner so i think just asking the question on here helped me find the solution!


Why0Why(Posted 2012) [#3]
That can often be the case. The community here is great and don't mind questions as long as you aren't spamming and genuinely trying to find the answer yourself.

Sometimes you just need an outside pair of eyes. I had something I had spent hours on and hacked around with so much that I just couldn't figure it out. Muddy_shoes posted back quickly with an answer and I it was a facepalm, but it is easy to miss stuff when you have been staring at the same thing for hours.

Welcome to the Monkey community. A great language and a great place!