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
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!
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!
Offline
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 endOr 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.
when I receive [next background v] next backgroundThis will make the background switch when the button sprite is pressed.
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 endKeep on repeating the "if this=that, then play this song" for however many scenes you have.
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 endThere'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 endNow, 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 endOr, if you are using a button:
when I receive [next background v] next background broadcast [music v]Both of these go under "Stage".
when green flag clicked stop all sounds broadcast [music v]Now, whenever you switch the scene, it will play the right music!
Last edited by 12_lassy (2012-03-17 12:13:06)
Offline
12_lassy wrote:
12_lassy wrote:
[Long post]
Mistakes, mistakes, mistakes.
I need to use the preview button more often.
Keep posting as informative as that, and you'll soon be able to edit them!
Last edited by RedRocker227 (2011-12-18 16:34:24)
Offline
Thanks for responding everyone! I finally have my project up, and it really helped!
Offline
Awesome evreyone! You can help so many ne scratchers and you dont even know it!
Offline