Hi, is there a simple way to make a sprite movieClip loop a predefined number of times? I've searched the forums, and tried nested ifs with event listeners, for loops etc but with no luck. I'm at a basic programmer skill level, so bare with me... ;;)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Thanks, your suggestion is similar to one that I've tried before. But I don't quite get what the framStepCounter variable is for. In this case none of the ifs get executed. What happens is that yourMovieClip runs once and then stops.
Which maybe raises a question a bit above all - my movieclips is played (one time, of course) as soon as they are added to stage, with no play() (or gotoAndPlay() etc) method in the code. Is that normal? :-/ I thought movieclips wouldn't play until play() or similar are called.
I think the movie clip can have an event.complete added - just set it so it plays it again and so on until a counter hits the amount you want.
Thanks, I think I've tried that with no luck. (Or maybe my brain was/is drained from all logic after a long week, thank god it's friday.) I'll try that again. With a movieclip.stop() before stage:addChild() so I don't have a animation running amok before running the counter (see previous post).
+1 for TNT Animator. There is a slight learning curve because you have to learn how Gideros Texture Packer works also, but both are pretty straight forward and easy to adapt to your projects using the supplied documentation and examples.
Hm, I think I actually NEED something like tnt animator, since my animations have to sync with sound (speech). Thus time-based, instead of frame-based. Thanks a lot, @pie!
Still, I'm curious - shouldn't a movieclip be playing only _after_ a play() method is called?
I did'nt test the code there can be small errors. The frameStepCounter is to delay your animation. Otherwise every 1/60 of a second a new image will be shown.
I forgot to add this:
if (frameStepCounter == 20) then frameStepCounter = 0
@pie@freessp I think I got a bit overenthusiastic over TNT as the perfect solution to my specific project. The TNT developer points out the pros of the time-based system over movieClip's fram-based. Since I can set the project's fps, I should have control over the frame timing anyway, right?
One thing that I don't seem able to control using TNT is how long a specific bitmap is shown (in a uncomplicated manner anyway?), which is cruical for my project. It includes lipsync of a quite large bitmap (over 700x700px). Several bitmaps/pngs are to be used in different animations, so unfortunately I think texturepacks is ruled out as well... (
@saeys the fact is that you have control on project fps, but it is an overall value (the whole project is affected) you can only choose just between 30 or 60 fps - and it's bound to device performance. TNT animator keeps track of that and allows you to have the same animation timing on any device/any project at any given framerate.
If you need a bitmap to stay longer, you can just clone it in tnt animator studio (as frame1, frame2,frame2, frame2, frame3...), it'won't be heavier since the texture is already loaded.
If I may, I think that using 700x700 frames is going to be really heavy, maybe in that situation it's better to embed videos with media plugin.
If your goal is just ipsync I think it could be worth to approach it differently: instead of animating a whole face with a backgroud and other static details on a big image you could "cut" your image and animate just what you need (mouth, eyes, hair) on a static background. Think about mouths in South Park or environment in old WB cartoons as an example. If you have many things to lipsync you could also think about writing a library to play animations reading a string -at first it won't be easy - but it should be worth the effort from the second lipsync you will have to animate.
It's not ready for gideros and I didn't try it yet, but as I understood it can export a dat file including timecode and frames. If you can manage to read it in gideros your job would be a lot easier.
About texturepacks, you should understand the best way to use them in your project: from what I know they are much faster to load than switching images. You should use them also if you are going on with movieclip
@pie Thanks for the input! As with every project there is a lot of factor to consider... :-)
It's not an ordinary lipsync project - my character's mouth is about as big as the rest of his body, and that's the point... :> He's not gonna talk that much each time either (which is, strange as it sounds, also the point).
As to the size - I've already tried to cut the pngs into parts to see how much kb can be reduced and concluded that, at least in this case, I get away with least image kb if I keep the character in one piece.
I'm on to your tip about writing a animation library to ease thing up from the second lipsync. :-)
Thanks anyway to you all for your answers, and the whole gideros forum in all, it's a great help! =D> I'll be back..
Comments
Likes: saeys
Likes: saeys
https://deluxepixel.com
Which maybe raises a question a bit above all - my movieclips is played (one time, of course) as soon as they are added to stage, with no play() (or gotoAndPlay() etc) method in the code. Is that normal? :-/ I thought movieclips wouldn't play until play() or similar are called.
http://www.tntparticlesengine.com/?page_id=405
It works really well, I am personally very happy about it: animations can cast events, set number of loops or infinte play and some more
Likes: freessp
Likes: saeys
Still, I'm curious - shouldn't a movieclip be playing only _after_ a play() method is called?
I did'nt test the code there can be small errors. The frameStepCounter is to delay your animation. Otherwise every 1/60 of a second a new image will be shown.
I forgot to add this:
if (frameStepCounter == 20) then
frameStepCounter = 0
Regards,
Marc
One thing that I don't seem able to control using TNT is how long a specific bitmap is shown (in a uncomplicated manner anyway?), which is cruical for my project. It includes lipsync of a quite large bitmap (over 700x700px). Several bitmaps/pngs are to be used in different animations, so unfortunately I think texturepacks is ruled out as well...
TNT animator keeps track of that and allows you to have the same animation timing on any device/any project at any given framerate.
If you need a bitmap to stay longer, you can just clone it in tnt animator studio (as frame1, frame2,frame2, frame2, frame3...), it'won't be heavier since the texture is already loaded.
If I may, I think that using 700x700 frames is going to be really heavy, maybe in that situation it's better to embed videos with media plugin.
If your goal is just ipsync I think it could be worth to approach it differently: instead of animating a whole face with a backgroud and other static details on a big image you could "cut" your image and animate just what you need (mouth, eyes, hair) on a static background. Think about mouths in South Park or environment in old WB cartoons as an example.
If you have many things to lipsync you could also think about writing a library to play animations reading a string -at first it won't be easy - but it should be worth the effort from the second lipsync you will have to animate.
You could also take a look at
http://www.lostmarble.com/papagayo/
It's not ready for gideros and I didn't try it yet, but as I understood it can export a dat file including timecode and frames. If you can manage to read it in gideros your job would be a lot easier.
About texturepacks, you should understand the best way to use them in your project: from what I know they are much faster to load than switching images. You should use them also if you are going on with movieclip
It's not an ordinary lipsync project - my character's mouth is about as big as the rest of his body, and that's the point... :> He's not gonna talk that much each time either (which is, strange as it sounds, also the point).
As to the size - I've already tried to cut the pngs into parts to see how much kb can be reduced and concluded that, at least in this case, I get away with least image kb if I keep the character in one piece.
I'm on to your tip about writing a animation library to ease thing up from the second lipsync. :-)
Thanks anyway to you all for your answers, and the whole gideros forum in all, it's a great help! =D> I'll be back..