Discuss Scratch

RJess14
Scratcher
1 post

Changing Backgrounds and Levels

I'm trying to figure out how to change the background for different levels in a simple game. I want for the background to change when my sprite touches a certain color. Can anybody help me out?!?
mwiedmann
Scratcher
100+ posts

Changing Backgrounds and Levels

Under the “Looks” group there is the “switch backdrop to ___ ” block.

On the Stage, there is also the “next backdrop” block that can be used to cycle through the backdrops.

So you should be able to do something like:

If touching color _ then
swtich backdrop
wait 1

You may want the “wait” or some other delay so the backdrops doesn't keep switching.
turkey3
Scratcher
1000+ posts

Changing Backgrounds and Levels

^^that or this:

when flag clicked
forever
wait until <touching color _?>
next backdrop
wait until <not <touching color _?>>
MasterCard786
Scratcher
100+ posts

Changing Backgrounds and Levels

when green flag clicked
forever

if <touching color [#f0f]?> then
switch costume to [ v]
switch backdrop to [ v]
go to x: () y: ()

end
end
Something like this is good for levels of a maze or something like that!
UniMog
Scratcher
58 posts

Changing Backgrounds and Levels

Hi RJess14

Is this the sort of thing you're looking for ?
http://scratch.mit.edu/projects/18309622
saebin
New Scratcher
1 post

Changing Backgrounds and Levels

I don't have touching color
taza156
New Scratcher
1 post

Changing Backgrounds and Levels

non of this worked help plase i want to get a L6 in it
deanowalk08
New Scratcher
1 post

Changing Backgrounds and Levels

thanks!
mcc_d_96
New Scratcher
1 post

Changing Backgrounds and Levels

hello there
bookreaderno1
Scratcher
1 post

Changing Backgrounds and Levels

your tricks dont work with me!
Birdlegs
Scratcher
1000+ posts

Changing Backgrounds and Levels

The best thing to do is to make a variable for levels. This way, you have lots of control over each level. An item that only appears in one level could show if your level variable is equal to a certain level and hide if it's anything else.
Airbender101
New Scratcher
2 posts

Changing Backgrounds and Levels

when a script is over, how do you change that background to another? trying to make a background for another background. Somebody please help.
Airbender101
New Scratcher
2 posts

Changing Backgrounds and Levels

deer33816
Scratcher
3 posts

Changing Backgrounds and Levels

Well, you could try using the broadcast buttons, like you put the broadcast on a sprite, and then say that the message is called: message1. So you drag a brown broadcast block onto the background script, and you'll have something that sounds like this: When I receive message1. Then you drag a purple “change background” block, and put it under the message1. Now it'll sound like this: When I receive message1, change the background to _____.
ianengel123
New Scratcher
1 post

Changing Backgrounds and Levels

how do you change levels twice
-Scratcher-
Scratcher
100+ posts

Changing Backgrounds and Levels

JoeyTheChicken wrote:

The best thing to do is to make a variable for levels. This way, you have lots of control over each level. An item that only appears in one level could show if your level variable is equal to a certain level and hide if it's anything else.
Agree! The easiest way is to use a variable for the levels.
For the stage:
forever
switch backdrop to (Level)
end
Additionally, I'm always broadcasting a message when a new Level starts, for each object for example:
when I receive [NextLvl v]
if <(Level) = [1]> then
show
repeat until <not <(Level) = [1]>>
Do what you want to do for Level 1 ::motion
end
end
if <(Level) = [3]> then
show
repeat until <not <(Level) = [3]>>
Do what you want to do for Level 3 ::motion
end
end
if <(Level) = [10]> then
show
repeat until <not <(Level) = [10]>>
Do what you want to do for Level 10 ::motion
end
end
... and so on ...
hide
So, now you can control everything with one sprite, which is your player.
when I receive [GameStart v]
go to [start position]
show
repeat until <(Level) = [0]> //I usually use Level=0 for the main menu, so repeat until the game ends
move how you want ::motion
if <touching color [#00dd00] ?> then //if touching good color
change [Level v] by (1)
broadcast [NexLvl v]
go to [start position]
end
if <touching color [#dd0000] ?> then //if touching bad color
set [Level v] to [0] //go back to main menu
end
end
hide

Last edited by -Scratcher- (May 29, 2015 11:02:24)

rara23
Scratcher
4 posts

Changing Backgrounds and Levels

you can do this script
when green flag clicked
forever
if <touching [whatever sprite you want v] ?> then
wait (0.4) secs
switch backdrop to [ next backdropv]
go to x: () y: (0)
end

end

Last edited by rara23 (July 4, 2015 23:02:30)

imalijah
Scratcher
10 posts

Changing Backgrounds and Levels

How do i make a sprite appear, on a certain level
hair444y
Scratcher
46 posts

Changing Backgrounds and Levels

imalijah wrote:

How do i make a sprite appear, on a certain level
when green flag clicked
hide
wait until <(level) = [2]>
show
repeat until <not <(level) = [2]>>
make it do you want to
end
jt83065
Scratcher
19 posts

Changing Backgrounds and Levels

saebin wrote:

I don't have touching color
YER YOU do you just cant find it because your a new sratcher you will lern how to one day find the block it is in the sensing or the blue hot bar

Powered by DjangoBB