I'm currently exploring what types of file Scratch will import. I tested an animated gif and it imported perfectly. Scratch then seemed to automatically dissect it into its 24 component parts (ie: frames). This spurs me to ask three questions:
(1) Is this the normal routine when importing an animated file? Can the animation only run within Scratch if it is then 'put back together again' as a sprite made up of several images?
(2) Is the best way to animate a multiple-image sprite to use a collection of 'switch to costume n' blocks with each one followed by 'wait n' secs'?
(3) When animating my own sprites, this idea worked, but when I tried this with the de-structured/restructured gif, the frames overwrote each other and it became a mess.
(4) Can an animated sprite (irrespective of whether or not it started life as an animated gif) be assigned a name so that in a main program that name can be 'called' and the sprite manipulated without having to include the long list of blocks which make up that character?
And after that list of 'newbie' questions, I'll close down, shut up and go to bed.
Offline
Hi Mohlar,
That's great that you were able to import an animated gif.
I'll try to answer your questions:
1) Yes, you need to program the animated gif yourself in Scratch
2) An easier way to animate a series of costumes is to use the "next costume" block:
e.g.,
"forever
next costume
wait 0.1 seconds"
(You can rearrange the order of the costumes by dragging and dropping.)
3) If the name of the animated gif is long, that may be why the frames overwrote each other. Try saving with a shorter name. (Or, as long as the images are in the order you want, then with "next costume" the names of the frames shouldn't matter as much.)
4) I wonder if "broadcast" would do what you're describing. In the animated sprite, try the block "when I receive message1" at the top of the animation script. Then in the main program use "broadcast message1 " (put any word you want in place of "message1").
For details, click "Want Help?" and see the Help Screens for the "broadcast" block.
Or please let us know if you have any further questions about any of this.
Offline
Thanks Natalie (I noticed that you also leapt into the post about reading long scripts, it's great knowing the development team are always on the lookout for places where they can help).
I'll use your notes with a future experiment. At the moment I'm still just learning the basics of Scratch, but so far two people have mentioned 'broadcast' as a possible solution to problems I've had .... so I think it's time I had a look at that to see what it does.
Thanks again.
Offline