Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make it so when a sprite touches the end it changes to another background
- 5ln73935
-
Scratcher
5 posts
How to make it so when a sprite touches the end it changes to another background
I have no idea how to make it so that when my sprite touches the end it goes to another background
- bRuHbRuHmEmEmAn
-
Scratcher
500+ posts
How to make it so when a sprite touches the end it changes to another background
I have no idea how to make it so that when my sprite touches the end it goes to another backgroundBy end, do you mean the edge? If so, here's a way to do it.
when gf clicked
forever
if <touching [edge v]?> then
next backdrop
wait until <not <touching [edge v]?>>
end
end
- 5ln73935
-
Scratcher
5 posts
How to make it so when a sprite touches the end it changes to another background
Thanks for the info also yes I meant edge but when I'm using it it keeps going into a loop how to make it so that it doesnt keep going and stops at a certain one.
Last edited by 5ln73935 (Jan. 21, 2024 02:01:03)
- chippysmall4
-
Scratcher
1000+ posts
How to make it so when a sprite touches the end it changes to another background
Don't use
In Backdrop
next backdropUse A Variable Called Stage
In Backdrop
when green flag clickedIn Player:
set [ Stage] to [1]
when I receive [next stage]
switch backdrop to (Stage)
when green flag clicked
forever
if <[(x position)] > [239]> then
set x to (-239)
change [Stage] by (1)
broadcast [Next Stage]
end
if <[(x position)] < [-239]> then
set x to (239)
change [Stage] by (-1)
broadcast [Next Stage]
end
Last edited by chippysmall4 (Jan. 21, 2024 06:03:30)
- 5ln73935
-
Scratcher
5 posts
How to make it so when a sprite touches the end it changes to another background
didnt work
- chippysmall4
-
Scratcher
1000+ posts
How to make it so when a sprite touches the end it changes to another background
didnt workCheck If You Matched The Code.
- pythonicKI
-
Scratcher
100+ posts
How to make it so when a sprite touches the end it changes to another background
(#4)Why don't use next backdrop?
Don't usenext backdropUse A Variable Called Stage
In Backdropwhen green flag clickedIn Player:
set [ Stage] to [1]
when I receive [next stage]
switch backdrop to (Stage)when green flag clicked
forever
if <[(x position)] > [239]> then
set x to (-239)
change [Stage] by (1)
broadcast [Next Stage]
end
if <[(x position)] < [-239]> then
set x to (239)
change [Stage] by (-1)
broadcast [Next Stage]
end
(#3)Do this instead:
Thanks for the info also yes I meant edge but when I'm using it it keeps going into a loop how to make it so that it doesnt keep going and stops at a certain one.
when gf clicked
forever
if <touching [edge v]> then
next backdrop
stop [this script v]
So the loop stops after the backdrop changes.
- chippysmall4
-
Scratcher
1000+ posts
How to make it so when a sprite touches the end it changes to another background
Stopping the Script Means They Can't Change The Level Again.(#4)Why don't use next backdrop?
Don't usenext backdropUse A Variable Called Stage
In Backdropwhen green flag clickedIn Player:
set [ Stage] to [1]
when I receive [next stage]
switch backdrop to (Stage)when green flag clicked
forever
if <[(x position)] > [239]> then
set x to (-239)
change [Stage] by (1)
broadcast [Next Stage]
end
if <[(x position)] < [-239]> then
set x to (239)
change [Stage] by (-1)
broadcast [Next Stage]
end(#3)Do this instead:
Thanks for the info also yes I meant edge but when I'm using it it keeps going into a loop how to make it so that it doesnt keep going and stops at a certain one.when gf clicked
forever
if <touching [edge v]> then
next backdrop
stop [this script v]
So the loop stops after the backdrop changes.
Using A Variable Means That The Level Can Be Easily Toggled
- HYTHON123
-
Scratcher
22 posts
How to make it so when a sprite touches the end it changes to another background
this is how you do it
when green flag clicked
forever
if <(x position) > > then
switch backdrop to
end
end
when green flag clicked
forever
if <(x position) > > then
switch backdrop to
end
end
- HYTHON123
-
Scratcher
22 posts
How to make it so when a sprite touches the end it changes to another background
when green flag clicked
forever
if <touching [edge v] ?> then
next backdrop
stop [this script v]
end
end
- DogeMeowy
-
Scratcher
100+ posts
How to make it so when a sprite touches the end it changes to another background
try(#4)Why don't use next backdrop?
Don't usenext backdropUse A Variable Called Stage
In Backdropwhen green flag clickedIn Player:
set [ Stage] to [1]
when I receive [next stage]
switch backdrop to (Stage)when green flag clicked
forever
if <[(x position)] > [239]> then
set x to (-239)
change [Stage] by (1)
broadcast [Next Stage]
end
if <[(x position)] < [-239]> then
set x to (239)
change [Stage] by (-1)
broadcast [Next Stage]
end(#3)Do this instead:
Thanks for the info also yes I meant edge but when I'm using it it keeps going into a loop how to make it so that it doesnt keep going and stops at a certain one.when gf clicked
forever
if <touching [edge v]> then
next backdrop
stop [this script v]
So the loop stops after the backdrop changes.
if <touching [edge v]> then
next backdrop
move (-10) steps
- jakob_sigmaohio
-
New Scratcher
1 post
How to make it so when a sprite touches the end it changes to another background
.
Last edited by jakob_sigmaohio (March 17, 2026 11:53:49)
- Discussion Forums
- » Help with Scripts
-
» How to make it so when a sprite touches the end it changes to another background