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

#1 2012-04-23 06:30:54

dbigland
New Scratcher
Registered: 2012-04-23
Posts: 2

backgrounds and scores

How can I use a score to change the background on a game? I want to change backgrounds when my score = 5

Offline

 

#2 2012-04-23 06:58:08

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: backgrounds and scores

Is your score set to a variable?

try this script:

if <(score) > [5]>
switch to background [background2 v]
end
You'll still need to trigger this script whenever your score changes, so if you're still stuck just say and someone will be sure to help!

I'm going to move this topic over to "Help with Scripts"!  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#3 2012-04-23 12:26:24

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: backgrounds and scores

shouldn't it be

when gf clicked
forever
if <(score)= [5]>
switch to background [background2 v]
end
end


http://i46.tinypic.com/ao03lk.png

Offline

 

#4 2012-04-23 13:06:49

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

Re: backgrounds and scores

PhirripSyrrip wrote:

shouldn't it be

when gf clicked
forever
if <(score)= [5]>
switch to background [background2 v]
end
end

Sparks's method works if the score suddenly goes above 5.

Offline

 

#5 2012-04-23 13:52:02

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: backgrounds and scores

Really is should be:

forever
   if <(score) > [5] or (score) = [5]>
   switch to background (background2)
   end
end


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#6 2012-04-23 13:53:59

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

Re: backgrounds and scores

zammer990 wrote:

Really is should be:

forever
   if <<(score) > [5]> or <(score) = [5]>>
   switch to background (background2)
   end
end

forever
   if <(score) > [4]>
   switch to background (background2)
   end
end
Gets the same functionality with 3 blocks fewer.  smile

Offline

 

#7 2012-04-23 14:16:01

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: backgrounds and scores

Yes, I just realised I meant to put > 4 not > 5, thanks for pointing it out!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#8 2012-04-24 11:17:47

dbigland
New Scratcher
Registered: 2012-04-23
Posts: 2

Re: backgrounds and scores

Thanks for that.
Game working a lot better now.

Offline

 

Board footer