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

#1 2012-08-01 06:54:14

GameCreator1997
New Scratcher
Registered: 2012-08-01
Posts: 1

Display Score but not on the variable view?! HELP!

I am making a pong game and I want to make a digital numbered score board. Could someone please explain to me how to do this?! Thanks  big_smile

Offline

 

#2 2012-08-01 07:10:47

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: Display Score but not on the variable view?! HELP!

Hello, and welcome to the forums!

This is achieved using stamping -- I trust that you've heard of it before? Anyway, you'll need a costume for each number (0-9 in that order) with the same width, and this script:

set [counter v] to (1)
repeat (length of (yournumbervariable))
 switch to costume ((item (counter) of (yournumbervariable)) + (1))
 stamp
 change x by (width) //The width of the costume.
 change [counter v] by (1)
end
Hope this helps!  big_smile

Last edited by Paddle2See (2012-08-01 09:10:04)


http://i50.tinypic.com/312u714.jpg

Offline

 

#3 2012-08-01 09:05:06

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Display Score but not on the variable view?! HELP!

BirdByte wrote:

Hello, and welcome to the forums!

This is achieved using stamping -- I trust that you've heard of it before? Anyway, you'll need a costume for each number (0-9 in that order) with the same width, and this script:

set [counter v] to (1)
repeat (length of [yournumbervariable v])
 switch to costume ((item (counter) of (yournumbervariable)) + (1))
 stamp
 change x by (width) //The width of the costume.
 change [counter v] by (1)
end
Hope this helps!  big_smile

Two things:

1). Instead of having the costumes 0-9 in order, you could have 1-9 and then 0 as the last costume. This would eliminate the need for the

(( ) + (1))
2. Changing x by the width of the costume would make the numbers crammed together. I recommend adding 2 to the width of the costume and changing x by that.

Other than that, I like your script!

Last edited by ErnieParke (2012-08-01 09:06:58)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer