Pages: 1
Topic closed
Something like
go to (score display start
clear
Switch to costume (letter (1) of (score)
stamp
change x by (20)
If (length of (score) > 1
Switch to costume (letter (2) of (score)
stamp
change x by (20)
If (length of (score) > 2
Switch to costume (letter (3) of (score)
stamp
change x by (20)
and so on and so forth.
Offline
AtomicBawm3 wrote:
Something like
go to (score display start
clear
Switch to costume (letter (1) of (score)
stamp
change x by (20)
If (length of (score) > 1
Switch to costume (letter (2) of (score)
stamp
change x by (20)
If (length of (score) > 2
Switch to costume (letter (3) of (score)
stamp
change x by (20)
and so on and so forth.
Yep, also for that to work you will need to have the numbers set out in the correct order in costumes, you will also need to add a plus 1 block in the switch to costume bit so you can do zero.
Offline
If it's just numbers, the best way is to have different sprites with costumes displaying the numbers 0-9. If the score isn't meant to go past 100, you could just use 2 of those sprites.
From there, you could put this in the sprite meant to display the entire score if it's 1 digit, or the second number if it has 2:
Then, for the sprite meant to display the first digit if it's over 10:
Something like that would work. You can also do this with more than two sprites.
The other way would simply be to stamp every digit in order quickly, clear and repeat, but the problem with that is that part of the background needs to be visible at all times, and any sprites going over it will block it out.
Last edited by hmnwilson (2010-08-29 15:44:34)
Offline
So make the score go over part of the background that doesn't change, copy that small part as a new sprite image, and stamp it first before stamping any score numbers.
edit: I'm working on a full-blown tutorial on this along with a simple demo project/game. It should be done sometime tomorrow. Oh wait, it is tomorrow lol. Starting to feel an all night code session coming on, been a while since the last one
Last edited by Locomule (2010-08-30 01:14:50)
Offline
I think Scratch Resources has stuff on this if you're feeling lazy though...
Offline
I wasn't feeling lazy
Here is my tutorial which has a link to the demo project as well...
Score Stamping tutorial with demo game project
Offline
I was talking to the topic owner - sorry about the confusion... ^^
Offline
AtomicBawm3 wrote:
Something like
go to (score display start
clear
Switch to costume (letter (1) of (score)
stamp
change x by (20)
If (length of (score) > 1
Switch to costume (letter (2) of (score)
stamp
change x by (20)
If (length of (score) > 2
Switch to costume (letter (3) of (score)
stamp
change x by (20)
and so on and so forth.
Oh, dear. It's really troublesome to have to make a costume for everything. But I completely forgot about the (letter (x) of (x) ) block, and instead have been doing some really complicated math for as long as I can remember, to achieve the same effect. Thanks so much for pointing that out!
Offline
Topic closed
Pages: 1