Sprites for Score display.

Get help using Construct 2

Post » Sun Feb 03, 2013 8:49 pm

I want to be able to pick up certain items and add to the score when they are picked up.

I also want the score to be able to be at least 3 characters long.

I've found some things on the forums about using sprites to display scores (usually numbers 0 through 9)

But none of them really explain things too well to help me understand what to do.

Does anyone know how to change the score when its picked up, and also change each of the 3 sprites that's being used, as the score increases, or know of a good tutorial that explains it well?

Any help is always appreciated, this has been kicking my butt for two days.
B
4
Posts: 78
Reputation: 606

Post » Sun Feb 03, 2013 9:33 pm

Something like this?

spriteScore.capx (r117)

The 'zeropad' expression makes sure you always have three numbers like 001 or 023 instead of just 1 and 23. Then you convert the score to a string with 'str' so you can use the 'mid' expression to pick a specific index of the string.

The corresponding sprites change frames depending on what number the 'mid' expression returns. For the number 234, it would be 2 for the first sprite, 3 for the second and 4 for the last.Nimtrix2013-02-03 21:34:15
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Feb 03, 2013 11:03 pm

Awesome! You sir, are magic. And thank you for taking the time to explain it all, it definitely helps! Thank you again!
B
4
Posts: 78
Reputation: 606

Post » Tue Feb 05, 2013 11:55 am

hey man! this will help me a lot too, because the appmobi doesnot accept text and settex to a var int.. have a bug.. a black screen when the game start...
So, working with sprites for the score and not text/numbers will work...

thanks man! @Nimtrix
B
22
S
2
G
5
Posts: 49
Reputation: 4,827

Post » Fri May 31, 2013 6:08 pm

WOW! Doesn't seem to be a reason to ever use text for scores anymore...
B
14
S
6
G
3
Posts: 71
Reputation: 3,811


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Rezzon71, shinkan, tarek2 and 21 guests