Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Going to Next Costume and Previous Costume
        ![[RSS Feed] [RSS Feed]](//cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)  
- bunny_lover4ever
- 
                             Scratcher Scratcher
11 posts
Going to Next Costume and Previous Costume
If you need help with your gallery on the previous sprite which can go previously. Try this code!
                        
                        
                    when this sprite clicked
switch costume to [((costume [number v]) - (1)) v]
- tidelgl
- 
                             Scratcher Scratcher
100+ posts
Going to Next Costume and Previous Costume
Scratch doesn’t have a built-in “previous costume” block, so we use math (current costume number - 1) to achieve this. And there are many way to do ti. Have fun.
                        
                            when [right arrow v] key pressed
next costume
when [left arrow v] key pressed
switch costume to ((costume #) - (1))
when [left arrow v] key pressed
switch costume to ((((costume #) - (1)) + (total costumes)) mod (total costumes))
when green flag clicked
forever
if <key [right arrow v] pressed?> then
next costume
end
if <key [left arrow v] pressed?> then
switch costume to ((((costume #) - (1)) mod (3)) // Replace 3 with your total costumes
end
end
when [space v] key pressed
repeat (4)
next costume
wait (0.2) seconds
end
Last edited by tidelgl (July 12, 2025 02:36:25)
- medians
- 
                             Scratcher Scratcher
1000+ posts
Going to Next Costume and Previous Costume
Guides aren't really made here, as we already have enough. Also, the suggestions forum has a workaround guide.
                        
                        
                    Scratch doesn’t have a built-in “previous costume” block, so we use math (current costume number - 1) to achieve this. And there are many way to do ti. Have fun.This was already said, but the blocks are broken, so it is confusing.
Scratch doesn’t have a built-in “previous costume” block, so we use math (current costume number - 1) to achieve this. And there are many way to do ti. Have fun.You don't have to do the mod (3) part, as going to the “0th costume” goes to the last costumewhen green flag clicked
forever
if <key [right arrow v] pressed?> then
next costume
end
if <key [left arrow v] pressed?> then
switch costume to ((((costume #) - (1)) mod (3)) // Replace 3 with your total costumes
end
end
- LittleGreyCells
- 
                             Scratch Team Scratch Team
1000+ posts
Going to Next Costume and Previous Costume
Hello!  It's great that you want to help out other Scratchers.  However, I think we have enough guides in the forums at the moment.  Please feel free to welcome new Scratchers on the group welcoming topic or on individual topics created by New Scratchers.
Other places that can always use more helpful Scratchers like you, are the “”Help With Scripts“” and “”Questions About Scratch“” areas - please use them as designed, by responding to topics created by folks with problems to solve
Finally, a really good place for Scratch guides is the Scratch Wiki - check it out and see if it's something you might like to work on. They have a number of guides - and great organization.
                        
                        
                    Other places that can always use more helpful Scratchers like you, are the “”Help With Scripts“” and “”Questions About Scratch“” areas - please use them as designed, by responding to topics created by folks with problems to solve

Finally, a really good place for Scratch guides is the Scratch Wiki - check it out and see if it's something you might like to work on. They have a number of guides - and great organization.
- Discussion Forums
- » Help with Scripts
- 
            » Going to Next Costume and Previous Costume ![[RSS Feed] [RSS Feed]](//cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)  
![[RSS Feed] [RSS Feed]](http://cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)



