Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make the background change when i hit the edge of the screen?
- FollowIgSaladSnake
-
Scratcher
1 post
How do I make the background change when i hit the edge of the screen?
oof
- Altion
-
Scratcher
100+ posts
How do I make the background change when i hit the edge of the screen?
if << <(mouse x) > [239]> or <(mouse x) < [-239]>> or <<(mouse y) < [-179]> or <(mouse y) > [179]>>> then
next backdrop
end
idk if you want the mouse or the player, if you want the player switch mouse x to x position and mouse y to y position;
change the numbers slightly to make more or less accuracy i guess
- Ayarkay
-
Scratcher
73 posts
How do I make the background change when i hit the edge of the screen?
when green flag clicked
forever
if <touching [edge v] ?> then
next backdrop
wait (1) secs
end
end
Continuously checks if the sprite is touching the edge of the stage. The only problem is that if something is touching the edge, the background will change, then immediately afterwards it checks if the sprite is touching the edge again, which can cause the backgrounds to switch incredibly rapidly. Hence the wait 1 secs block. It simply give you a second to move your sprite away from the edge so the backgrounds don't switch 30 times a second.
Last edited by Ayarkay (Aug. 17, 2017 15:59:00)
- AcousticGuy
-
Scratcher
87 posts
How do I make the background change when i hit the edge of the screen?
I would use:
when green flag clicked
forever
if <touching [ edge] ?> then
switch backdrop to [ the name of the backdrop]
wait until <not <touching [ edge] ?>>
end
end
Last edited by AcousticGuy (Aug. 17, 2017 20:02:35)
- Ayarkay
-
Scratcher
73 posts
How do I make the background change when i hit the edge of the screen?
I would use:when green flag clicked
forever
if <touching [ edge] ?> then
switch backdrop to [ the name of the backdrop]
wait until <not <touching [ edge] ?>>
end
end
Word, that's more robust than simply waiting a second like the one I posted.
- coding4life22
-
Scratcher
66 posts
How do I make the background change when i hit the edge of the screen?
This Script would work :
when green flag clicked
forever
if <touching [edge] ?> then
switch backdrop to [(insert backdrop name here)]
end
end
- R-ley
-
Scratcher
5 posts
How do I make the background change when i hit the edge of the screen?
I would use:
Happy to help any time!














when green flag clicked
forever
if <touching [edge v] ?> then
next costume
end
end
Happy to help any time!















- Orangey2011
-
Scratcher
100+ posts
How do I make the background change when i hit the edge of the screen?
I was wondering the same thing, but I saw that there was no “next backdrop” in sprites.
So what do I do if I was going to do that one?
So what do I do if I was going to do that one?
- Roto-N
-
Scratcher
1 post
How do I make the background change when i hit the edge of the screen?
but what if I only wanted it to change when I hit the right wall?
- deck26
-
Scratcher
1000+ posts
How do I make the background change when i hit the edge of the screen?
I was wondering the same thing, but I saw that there was no “next backdrop” in sprites.You could drag and drop the next backdrop block from the stage or just broadcast to get the stage to make the change.
So what do I do if I was going to do that one?
but what if I only wanted it to change when I hit the right wall?Check for x > 235 or whatever suits but remember if you check this in a forever loop and don't move the sprite it will keep changing. using wait until x > 235, next backdrop and wait until x < 235 before looping is one way round that problem.
- haiaprjcms19
-
New Scratcher
1 post
How do I make the background change when i hit the edge of the screen?
i cant find touching edge button…
- tvwin34
-
Scratcher
1 post
How do I make the background change when i hit the edge of the screen?
It only works on the left side. is there a way to fix that?
- DerpyHead0
-
Scratcher
1000+ posts
How do I make the background change when i hit the edge of the screen?
i cant find touching edge button…sensing, use the dropdown.
It only works on the left side. is there a way to fix that?you probably chose a bad script or did someting wrong.
but for both of you, make your own posts when you have questions, and don't necropost.
- Africansavannah07
-
Scratcher
1 post
How do I make the background change when i hit the edge of the screen?
i can't find touching edge button…
- VideoGameFreak75
-
New Scratcher
1 post
How do I make the background change when i hit the edge of the screen?
Neither can I. Something is wrong with scratch there is not all of the scratch blocks on the side of the screen
- Falcon0327
-
Scratcher
71 posts
How do I make the background change when i hit the edge of the screen?
Try this:
when green flag clicked
forever
wait until <<(x position) > [220]> or <(x position) < [-220]>>
next backdrop
end
- CuriousGamer
-
Scratcher
60 posts
How do I make the background change when i hit the edge of the screen?
i cant find touching edge button…
i can't find touching edge button…
Neither can I. Something is wrong with scratch there is not all of the scratch blocks on the side of the screen
By default, it is this:
<touching [mouse-pointer v] ?>Click the dropdown box to change it from mouse-pointer to edge
<touching [edge v] ?>
- PersRufaro
-
Scratcher
100+ posts
How do I make the background change when i hit the edge of the screen?
Please don't necropost. This topic is already resloved.i cant find touching edge button…i can't find touching edge button…Neither can I. Something is wrong with scratch there is not all of the scratch blocks on the side of the screen
By default, it is this:<touching [mouse-pointer v] ?>Click the dropdown box to change it from mouse-pointer to edge<touching [edge v] ?>
- tannh017
-
Scratcher
1 post
How do I make the background change when i hit the edge of the screen?
maybye
if <> then
<touching [ v] ?>end
switch backdrop to [ v]
- Discussion Forums
- » Help with Scripts
-
» How do I make the background change when i hit the edge of the screen?


















