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

#1 2011-09-09 08:59:08

zippolulu
Scratcher
Registered: 2010-05-04
Posts: 9

Changing backgrounds

Next problem:
I want to change background when my game character has reach a pink dot, turned into character 2.
I manage to change the background using broadcast but then I can't get the start background back when I click the green flag. The background 2 is fixed so to speak.

On the sprite I use broadcast level 2 within my script:
[forever
  if touching color
  switch to costume Y (new character for level 2)
  play sound
  broadcast level2
  stop script


on stage
When receive level2
Switch to background2

I also have the script
when green flag clicked
[forever
switch to background1
stop all sound
stop script

Thanks: Z

Offline

 

#2 2011-09-09 09:06:11

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Changing backgrounds

Don't include the stop script blocks. Does that change anything?

Offline

 

#3 2011-09-09 19:59:15

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Changing backgrounds

Instead having this script:

Code:

when green flag clicked
forever
    switch to background1
    stop all sound
    stop script

I would recommend just removing the loop and stop blocks. That tends to cause a lot of problems by stopping other running scripts.

Code:

when green flag clicked
switch to background1

http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#4 2011-09-11 16:46:11

zippolulu
Scratcher
Registered: 2010-05-04
Posts: 9

Re: Changing backgrounds

Thanks for advices but:
If I take away the stop script for the sprite the sound is hacking without end.
If I take away the loop and stop block for the stage nothing change.
I can't get background1 back when click on green flag...
sad

Offline

 

#5 2011-09-11 16:54:17

Death_Wish
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Changing backgrounds

zippolulu wrote:

Thanks for advices but:
If I take away the stop script for the sprite the sound is hacking without end.
If I take away the loop and stop block for the stage nothing change.
I can't get background1 back when click on green flag...
sad

Post the project, that way we might be able to help.


With a straight flush.
http://4.bp.blogspot.com/-FlUhnzmIROE/TgtpjdJl4tI/AAAAAAAABCM/W19pvFTZFaU/s1600/save_the_world.png http://blocsonic.com/images/special/rip-stevejobs.jpg

Offline

 

#6 2011-09-11 17:04:43

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Changing backgrounds

zippolulu wrote:

Thanks for advices but:
If I take away the stop script for the sprite the sound is hacking without end.
If I take away the loop and stop block for the stage nothing change.
I can't get background1 back when click on green flag...
sad

I assume you mean the sound keeps starting over and over again by "hacking without end." That's caused by the loop block - the stop all block terminates the loop.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#7 2011-09-11 17:20:28

zippolulu
Scratcher
Registered: 2010-05-04
Posts: 9

Re: Changing backgrounds

The stop all block at the stage does change to Background1 but then I can move my character....
Z

Offline

 

#8 2011-09-11 18:12:18

zippolulu
Scratcher
Registered: 2010-05-04
Posts: 9

Re: Changing backgrounds

I have found the problem. It is a totally pink background (filled with the bucket) which doesn't work. Made a new one in green, it worked. Hm so scratch is sensitive to pink?
Z

Offline

 

#9 2011-09-11 18:35:40

Death_Wish
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Changing backgrounds

zippolulu wrote:

I have found the problem. It is a totally pink background (filled with the bucket) which doesn't work. Made a new one in green, it worked. Hm so scratch is sensitive to pink?
Z

No... It doesn't have anything to do with pink... No idea why, then.


With a straight flush.
http://4.bp.blogspot.com/-FlUhnzmIROE/TgtpjdJl4tI/AAAAAAAABCM/W19pvFTZFaU/s1600/save_the_world.png http://blocsonic.com/images/special/rip-stevejobs.jpg

Offline

 

Board footer