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

#1 2008-10-26 14:29:03

techstars
Scratcher
Registered: 2008-10-07
Posts: 8

change stage when sprite touches edge

I have one sprite and several stages. I want my sprite to 'walk' through all of the stages. How do I get the stage to move to the next one when it touches the right edge of the current stage?
I already figured out how to move my sprite from the right side of the stage to the left, now I need to get the stage to change. Please help, I am new to this and can't find this answer anywhere. I know it must be fairly simple.

Offline

 

#2 2008-10-26 14:59:36

funkymonkey
Scratcher
Registered: 2007-06-03
Posts: 1000+

Re: change stage when sprite touches edge

put this script on the sprite:

<when green flag clicked>
<forever>
<if><touching[ edge
<broadcast[ go to next costume
<go to x sad  -180 )y sad  -78

then give this script to the stage:

<when I receive[ go to next costume
<switch to costume[ next costume

<when green flag clicked>
<switch to costume[ begining costume

i think that'll work

Last edited by funkymonkey (2008-10-26 15:03:17)


http://i243.photobucket.com/albums/ff67/hprules_photos/banner2.jpg
Kuzimu: Dawn of a New Age                                                                                                  Coming May 2010

Offline

 

#3 2008-10-26 15:02:05

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

Re: change stage when sprite touches edge

in touching edge script, do this:

[blocks]
<broadcast[ stage-change ]>
[/blocks]

In stage:

<when I receive[ stage-change ]>
<next costume>

Offline

 

#4 2008-10-26 17:39:38

techstars
Scratcher
Registered: 2008-10-07
Posts: 8

Re: change stage when sprite touches edge

Thanks funkymonkey and bhz. Between your 2 suggestions I was able to figure it out. It was easier than I thought!

Offline

 

Board footer