This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-05-17 21:48:53

Jaceguay
Scratcher
Registered: 2007-05-17
Posts: 2

previous costume

Hi, I'm using a key to play a animation of a walkthougt, I'm using "next costume" to play one frame after another everytime the key is pressed, I want to know if there is something like "previous costume" or how to create the effect of play the animation reversed when another key is pressed.
Thanks in advance.

Jaceguay Zukoski

Offline

 

#2 2007-05-18 02:30:58

Greatness
Scratcher
Registered: 2007-05-10
Posts: 19

Re: previous costume

Hrmm,

Sadly, there is no 'Previous Costume' block, but I may have an idea that might work.

Step 1: Name all your costumes of the sprite, in order, from 1 to, lets just say 100
Step 2: Make a Variable called 'Costume' for example. And set it's value to the first costume. So if the first costume is called '1', set value of Costume to 1
Step 3: In the coding for the 'Next' key. Make it so when it's pressed, increases 'Costume' Variable by 1, and get the 'switch to costume' block and drag the 'costume variable' into the drop down box.
Step 4: In the coding for the 'Previous' key. Do the same as above but chance costume by -1.

Test it out. This should work.

If you have any problems and want me to make some screenshots or a sample program, just post here.

Offline

 

#3 2007-05-18 15:14:24

Jaceguay
Scratcher
Registered: 2007-05-17
Posts: 2

Re: previous costume

Thank you, It really help.
It's, even better this way than with next animation because I have more control over the animation.
Thanks again.

Offline

 

#4 2007-05-19 01:00:20

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: previous costume

There *used to be* a "change costume by ___" block, which they replaced by the less flexible "next costume" to make things simpler for beginners.  It took me a long time to realize that "set costume"  accepted numbers.  I thought they had restricted things to just named costumes.  I think it was clearer before with the "change costume by __" block, but I'm not really the target audience.

Offline

 

Board footer