I would like a script to be able to stamp my score variable as I've seen in some other projects so I don't have to use the orange box. Thanks!
Offline
You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0
(the tens is where the tens, e.g. 10 is 1 ten, go)
when gf clicked forever // Forever stamping the values clear goto x: (x position of the tens) y: (y position of the tens) if <(length of (score)) > [1]> switch to costume (letter (1) of (score)) stamp move (spacing between tens and units) steps switch to costume (letter (2) of (score)) else switch to costume (letter (1) of (score)) end stamp
Last edited by rdococ (2012-01-29 10:54:10)
Offline
Try this.
Or search scratch resources for something similar
Last edited by hello12345678910 (2012-01-29 10:54:40)
Offline
rdococ wrote:
You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0
(the tens is where the tens, e.g. 10 is 1 ten, go)when gf clicked forever // Forever stamping the values clear goto x: (x position of the tens) y: (y position of the tens) if <(length of (score)) > [1]> switch to costume (letter (1) of (score)) stamp move (spacing between tens and units) steps switch to costume (letter (2) of (score)) else switch to costume (letter (1) of (score)) end stamp
That only works for up to 2 digits
Offline
hello12345678910 wrote:
Try this.
Or search scratch resources for something similar
Thanks, but not the technique I'm looking for. I find it unnecessary to make a sprite for each digit of the score.
Offline
My project Unpredictable! uses the "stamping" method. You can download it to check out the scripts. It basically revolves around changing the x position, switching to a costume, and stamping.
Last edited by RedRocker227 (2012-01-29 12:01:03)
Offline
Thanks, but I'd like a script that can do that with a score that always changes.
Offline
Just put it in a "forever" block
Offline
My project, text drawing with only 1 costume can draw text and numbers with only one costume.
Offline
Hi, 1 sprite version that I posted a while ago here: Score Sprite
Hopefully the scripts can help you.
It does use a few variables and you may be able to cut one out if you think about it - not sure; haven't checked it in a while.
Offline
Smozzick wrote:
Hi, 1 sprite version that I posted a while ago here: Score Sprite
Hopefully the scripts can help you.
It does use a few variables and you may be able to cut one out if you think about it - not sure; haven't checked it in a while.
Exactly what I was looking for, thanks!
Offline
Before scripting:
Set to don't rotate.
when gf clicked point in direction (90) go to x:(starting x) y:(starting y) set [currentone] to (0) forever repeat (length of text) switch to costume (join [number](next change)) stamp move (amnt2move) steps set [currentone] to ((currentone)+(1)) set [next change] to (letter (currentone) of [score]) end endExtension of rdococ's script.
Last edited by bbbeb (2012-01-30 05:37:42)
Offline
ChunkyMonkeyGames wrote:
rdococ wrote:
You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0
(the tens is where the tens, e.g. 10 is 1 ten, go)when gf clicked forever // Forever stamping the values clear goto x: (x position of the tens) y: (y position of the tens) if <(length of (score)) > [1]> switch to costume (letter (1) of (score)) stamp move (spacing between tens and units) steps switch to costume (letter (2) of (score)) else switch to costume (letter (1) of (score)) end stampThat only works for up to 2 digits
I see.
Let me try to make something that works for any digit.
when gf clicked forever // Forever stamping the values clear goto x: (x position of the first number) y: (y position of the total number) set [iteration v] to [1] repeat (length of (score)) switch to costume (letter (iteration) of (score)) stamp change x by (spacing inbetween all numbers) change [iteration v] by (1) endNotice the repeat block makes it able to display an unlimited amount of digits or atleast up to where it reaches the edge.
Last edited by rdococ (2012-01-30 12:46:16)
Offline
Even though I think you have what you're looking for you could use this (which I made last year)
Offline
bbbeb wrote:
So rdococ you pretty much did the same thing I did except with a little optimization?
Looks like it, costumes work with costume numbers too, and there is only one variable instead of two.
And, if it is a non-existent costume (e.g. switch to costume (0) when there's 1, 2, 3, and 4 costume numbers) it rolls back to the opposite and continues on.
So with 1,2,3,4,5,6,7,8,9,10 costume numbers in my script, "0" means costume "10", which visually looks like a "0", so with my script it uses costume numbers, not names.
----------------------
Lol, many of my posts on these topics are in a sticky
Last edited by rdococ (2012-01-31 06:23:51)
Offline
rdococ wrote:
ChunkyMonkeyGames wrote:
rdococ wrote:
You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0
(the tens is where the tens, e.g. 10 is 1 ten, go)when gf clicked forever // Forever stamping the values clear goto x: (x position of the tens) y: (y position of the tens) if <(length of (score)) > [1]> switch to costume (letter (1) of (score)) stamp move (spacing between tens and units) steps switch to costume (letter (2) of (score)) else switch to costume (letter (1) of (score)) end stampThat only works for up to 2 digits
I see.
Let me try to make something that works for any digit.when gf clicked forever // Forever stamping the values clear goto x: (x position of the first number) y: (y position of the total number) set [iteration v] to [1] repeat (length of (score)) switch to costume (letter (iteration) of (score)) stamp change x by (spacing inbetween all numbers) change [iteration v] by (1) endNotice the repeat block makes it able to display an unlimited amount of digits or atleast up to where it reaches the edge.
I tried this on Scratch in one of the games I'm making, and I think that it would be better without the "clear" block; it makes the numbers flicker. Instead, this script worked fine in my game:
when gf clicked clear forever // Forever stamping the values goto x: (x position of the first number) y: (y position of the total number) set [iteration v] to [1] repeat (length of (score)) switch to costume (letter (iteration) of (score)) stamp change x by (spacing inbetween all numbers) change [iteration v] by (1) end
Offline
jedidiahzhu wrote:
rdococ wrote:
ChunkyMonkeyGames wrote:
That only works for up to 2 digitsI see.
Let me try to make something that works for any digit.when gf clicked forever // Forever stamping the values clear goto x: (x position of the first number) y: (y position of the total number) set [iteration v] to [1] repeat (length of (score)) switch to costume (letter (iteration) of (score)) stamp change x by (spacing inbetween all numbers) change [iteration v] by (1) endNotice the repeat block makes it able to display an unlimited amount of digits or atleast up to where it reaches the edge.I tried this on Scratch in one of the games I'm making, and I think that it would be better without the "clear" block; it makes the numbers flicker. Instead, this script worked fine in my game:
when gf clicked clear forever // Forever stamping the values goto x: (x position of the first number) y: (y position of the total number) set [iteration v] to [1] repeat (length of (score)) switch to costume (letter (iteration) of (score)) stamp change x by (spacing inbetween all numbers) change [iteration v] by (1) end
Then you get shadows of the previous numbers... What I did was make another costume, the color of the background, and have it stamp, then the number.
Offline
Yeah, when I added it in I noticed that. So in solution I added:
when i recieve [change v]
clear
Explanation:
The number I stamp is the GOLD amount in the game. So whenever someone buys something (in other words, the GOLD amount changes), the script broadcasts change.
Offline
rdococ wrote:
You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0
(the tens is where the tens, e.g. 10 is 1 ten, go)when gf clicked forever // Forever stamping the values clear set [temporary value v] to (score) goto x: (x position of the tens) y: (y position of the tens) if <(length of (score)) > [1]> switch to costume (letter (1) of (score)) stamp move (spacing between tens and units) steps switch to costume (letter (2) of (score)) else switch to costume (letter (1) of (score)) end stamp wait until <not <(score) = (temporary value)>>
This way reduces lag in huge games, and reduces the possibility of the score flashing while a player is interacting with your project (:
Offline
You could also just change the variable color if you don't like orange!
Offline
ChunkyMonkeyGames wrote:
I would like a script to be able to stamp my score variable as I've seen in some other projects so I don't have to use the orange box. Thanks!
You just have a sprite or a few that have costumes with numbers 0-9
Offline