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

#1 2012-09-15 11:41:16

cutekittenkatie
New Scratcher
Registered: 2012-08-24
Posts: 9

Score

I have made a game and wondered if the was a good way to show a score other than creating a variable. Thanks :-)

Offline

 

#2 2012-09-15 11:43:43

banana500
Scratcher
Registered: 2009-09-06
Posts: 1000+

Re: Score

You can create a sprite with different costumes representing each number on the scoreboard. You may have to use different sprites for thousands, hundreds, tens, and ones. Make a variable that has the score, but based on that score, display the correct costume that corresponds with that score. That way, you don't have to display the variable, but you can still show your score, in a nice way. Also, be sure to make your scoreboard look stylish!

Hope this helped!  smile


http://i.imgur.com/jrCyB2r.gif
'Cause I'm NUMBER ONE.

Offline

 

#3 2012-09-15 11:52:20

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

Re: Score

^that
have costumes 0-9, then use this script (this is the 1 sprite version"

when gf clicked
forever
clear
go to x:(position of thousands) y:(position of scoreboard)
switch to costume ((letter (1) of (score)) +(1))//+1 so 0 becomes costume 1
stamp
go to x:(position of hundreds) y:(position of scoreboard)
switch to costume ((letter (2) of (score)) + (1))
stamp
go to x:(position of tens) y:(position of scoreboard)
switch to costume ((letter (3) of (score)) +(1))
stamp
go to x:(position of units) y:(position of scoreboard)
switch to costume ((letter (4) of (score)) + (1))


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

Offline

 

#4 2012-09-15 12:21:46

cutekittenkatie
New Scratcher
Registered: 2012-08-24
Posts: 9

Re: Score

It doesn't work if there is no 1000s!! HELP!

Offline

 

#5 2012-09-15 13:28:40

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Score

You just have to add leading 0's if the score doesn't contain them.  Add this at the beginning of that script (provided that the score will have 4 digits).

set [DisplayScore v] to (score)
if <(length of [score v]) = (1)>
set [DisplayScore v] to (join [000] (score))
end
if <(length of [score v]) = (2)>
set [DisplayScore v] to (join [00] (score))
end
if <(length of [score v]) = (3)>
set [DisplayScore v] to (join [0] (score))
end
Then, change the script for drawing/stamping to choose letter (_) of (DisplayScore), not (score).  That should do it.

Last edited by amcerbu (2012-09-15 13:30:05)

Offline

 

Board footer