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

#1 2011-12-18 15:03:44

MoonshineKitty
Scratcher
Registered: 2011-12-17
Posts: 16

2 Questions...?

Hi everyone, I'm MoonshineKitty, a new Scratcher here, and I basically have some of Scratch down, but I have two questions:

1. How do you change scenes? I'm making a project where it switches from a title page, to a forest background, to another background, and I'm not sure how that works.

2. How do you add music to different scenes? I know how to add music to the whole project, but how/can you change the music when a different background/stage comes up?

Thanks for helping, and Scratch on!

Offline

 

#2 2011-12-18 15:21:45

lilacfuzz101
Scratcher
Registered: 2010-05-22
Posts: 1000+

Re: 2 Questions...?

MoonshineKitty wrote:

Hi everyone, I'm MoonshineKitty, a new Scratcher here, and I basically have some of Scratch down, but I have two questions:

1. How do you change scenes? I'm making a project where it switches from a title page, to a forest background, to another background, and I'm not sure how that works.

2. How do you add music to different scenes? I know how to add music to the whole project, but how/can you change the music when a different background/stage comes up?

Thanks for helping, and Scratch on!

Welcome to Scratch MoonshineKitty!  big_smile

1. You'll want to select the stage (by clicking on the area labeled "Stage" next to the area where all of your sprits are found) and then look under the "Looks" (purple)section of blocks. There's a block there called "switch to background____" which should do the trick!

2. If you want to change the music, try using the "Stop all sounds" block and then switch the sound to what you want it to play for that scene.

I hope that helps!  smile


http://25.media.tumblr.com/tumblr_lzqaicLrY01r5wdo7o1_500.gif

Offline

 

#3 2011-12-18 16:15:41

12_lassy
Scratcher
Registered: 2011-07-23
Posts: 13

Re: 2 Questions...?

Hello Moonshine! Changing the scene/background of a project is similar to changing a sprite's costume. First, you need to give the stage several backgrounds. For example, your said title background and forest background.

Now, I'm assuming you want the title background to come first, for obvious reasons. First, create the background as a costume for the stage.

The first script for the stage should be this:

when green flag clicked
switch to background [title v]
In order to switch backgrounds, you need a trigger, like pressing a button or the spacebar. This can be done with this script for the stage:

when green flag clicked
forever
if <key [space v] pressed?>
next background
end
end
Or you can create a new sprite to be a "button" and give the button a script like this:

when [button v] clicked
broadcast [next background v]
This will send a signal to the stage to change it's background.

You need to give the stage a script that tells it what to do when it gets the signal:

when I receive [next background v]
next background
This will make the background switch when the button sprite is pressed.

You can make this happen by other means, but those two are some simple examples.

Now, to get music for each different scene, first you have to make all the different backgrounds. Put these in chronological order (the order in which you want them to play out when your project is played). Then you need to find and get music for each scene.

You give this script to the stage:

**In this script, "background #1" is the title screen, and background #2 is the forest scene.

when green flag clicked
forever
if <(background #)=(1)>
play sound [title1 v] until done
end
if <(background #)=(2)>
play sound [forest1 v] until done
end
end
Keep on repeating the "if this=that, then play this song" for however many scenes you have.

There is actually a purple block for "background #", which you can find under "Looks" in the Stage. You put the "background #" block in the first space for the green block, and the # of the background in the second space. You can find out the background # by going to the Stage's "Background" tab. The number will be on the left of the picture, in the top left corner. This script tells the stage to play a certain sound whenever the background number is 1, 2, 3, etc.

There's a problem with the above script, though. If you don't tell it to wait for the song to finish, it will keep on playing the song forever! You will have to give it "stop all sounds" blocks, so if the scene switches, it will stop the previous song and go to the right one.

So the script will now look like this:

when green flag clicked
stop all sounds
forever
if <(background #)=(1)>
stop all sounds
play sound [title1 v] until done
end
if <(background #)=(2)>
stop all sounds
play sound [forest1 v] until done
end
end
There's still a problem, though. If you go to a different scene before the first song finishes playing, it will keep on going even after you switch the scene! So, you can use 'broadcast' blocks to fix the problem. You will need to put the above script under a different "hat block" (the first block on the script). It will look like this now:

when I receive [music v]
stop all sounds
forever
if <(background #)=(1)>
stop all sounds
play sound [title1 v] until done
end
if <(background #)=(2)>
stop all sounds
play sound [forest1 v] until done
end
end
Now, you will need to add "broadcast: music" to the script(s) that tell the stage to switch backgrounds. So,  your "switch scene" scripts will now look like this:

<when green flag clicked>
<forever>
if <key [space v] pressed?>
next background
broadcast [music v]
end
end
Or, if you are using a button:

when I receive [next background v]
next background
broadcast [music v]
Both of these go under "Stage".

Also, since the title screen is the first background you will see, you will have to add this:

when green flag clicked
stop all sounds
broadcast  [music v]
Now, whenever you switch the scene, it will play the right music!

Still confused? Sorry, I am not very good at explaining things.

Here's an example project you can download with all the scripts I mentioned before, so you can better understand:

Click me!

Last edited by 12_lassy (2012-03-17 12:13:06)


http://i552.photobucket.com/albums/jj357/12_lassy/scratchsiggy.png

Offline

 

#4 2011-12-18 16:33:31

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: 2 Questions...?

12_lassy wrote:

12_lassy wrote:

[Long post]

Mistakes, mistakes, mistakes.

I need to use the preview button more often.  tongue

Keep posting as informative as that, and you'll soon be able to edit them!  smile

Last edited by RedRocker227 (2011-12-18 16:34:24)


Why

Offline

 

#5 2011-12-18 17:42:41

Freakish
Scratcher
Registered: 2011-10-25
Posts: 1000+

Re: 2 Questions...?

Welcome to Scratch, MoonshineKitty!  big_smile


http://i.imgur.com/y3RBV.jpg

Offline

 

#6 2011-12-18 22:01:19

MoonshineKitty
Scratcher
Registered: 2011-12-17
Posts: 16

Re: 2 Questions...?

Thanks for responding everyone! I finally have my project up, and it really helped!  smile

Offline

 

#7 2011-12-18 22:12:00

Freakish
Scratcher
Registered: 2011-10-25
Posts: 1000+

Re: 2 Questions...?

MoonshineKitty wrote:

Thanks for responding everyone! I finally have my project up, and it really helped!  smile

Cool! I'll check it out.  smile


http://i.imgur.com/y3RBV.jpg

Offline

 

#8 2011-12-24 08:37:55

caitlyn22222
Scratcher
Registered: 2011-12-04
Posts: 4

Re: 2 Questions...?

Awesome evreyone! You can help so many ne scratchers and you dont even know it!

Offline

 

Board footer