[SOLVED] Start actor's animation from random frame?

Almakos

  • Posts: 632
In other words, is it possible to randomize animations each time they are triggered?

« Last Edit: June 03, 2012, 10:34:03 pm by Almakos »
Fishing Fantasy Trailer


Ryusui

  • Posts: 827
Of course. Set the actor's animation and then set the frame.

NOTE: I haven't tried this. ^_^; But it seems like it ought to logically work, right?
In the event of a firestorm, the salad bar will remain open.

Almakos

  • Posts: 632
em....I have animation and there 30 sprites in it. so, how exactly can I set frame from which it should play?  :o

I can duplicate existing animation and rearrange frames so I would have prepared random animations, but this is very troublesome and I can make unwanted mistakes.. So I would better find a way how to start from random frame each time.
Fishing Fantasy Trailer


hansbe

  • Posts: 262
There are just a few blocks you need: "get frame count for [actor]" and "switch to frame [number]  for [actor]", then use the get random number block to get a random number for the frame between 0 and the frame count ....

Almakos

  • Posts: 632
Thank you guys. I was struggling for a while with this riddle.
Here is a code what I've got, just in case any one else would need same thing
Fishing Fantasy Trailer


h1rnz1lla

  • *
  • Posts: 649
cool, is this flash or iOS? because i tried something similar in iOS and it seems to crash every time.

captaincomic

  • *
  • Posts: 6108
It looks like it should work on both Flash and iOS. At least I can't see anything that wouldn't work on iOS.