|
I'm having trouble getting my 2d animation to play properly. I have a character that has an idle animation, I've made it so that when you click on the character the animation changes to something else. I want it to play all of the frames of the animation (when clicked) and then return to it's idle state when the animation is finished, however i've tried using a yield WaitForSeconds at the length of the animation but this stops it from playing as though it's been paused, which I guess it kinda has. it freezes on the frame that the yield became active. I'm working with the animation code from the walker boys 2d mario tutorial which calls the frames in sequence in the code. I understand that Yield basically stops the code and thus stops my animation from playing the next frame. So i'm wondering if there is another way that I can wait a few seconds for my animation to finish before I switch back to the idle state. Cheers. Here's the code that I'm working with: if (idle) { if (clicked){ if (Input.GetMouseButtonDown(0) ) { if(Physics.Raycast(ray,hit,100.0)) { }
(comments are locked)
|
|
heya, you could simply introduce a timer. store the game time into a variable when clicked turns to true and then have a conditional that checks if the game time is bigger than the stored time + an offset. eg: hope that helps a bit. That's great, just what I needed. Thanks a lot Pheash!
Jun 27 '12 at 08:31 PM
reltuc
np. could you mark the question as answered to keep the forums clean?
Jul 24 '12 at 09:52 AM
pheash
(comments are locked)
|
