What is the most efficient way to set a sprite (say I've made sprites of the numbers 0-9 in a cool sci-fi font) to link to a variable, so that when that variable changes from 0 to 1 to 2 etc. the sprite will reflect that number? So, the variable score changes to 1, the sprite will show the number 1?
(basically I'm trying to set up a custom score indicator for my game linked in my signature using a sprite rather than the default variable box)
Thanks for any help
Last edited by SD7 (2012-04-16 14:25:45)
Offline
Probably using this:
forever switch to costume ((letter (length of (score)) of (score)) + [1]) //+1 so you can include 0and on another sprite
forever if <(score) > [9]> switch to costume ((letter ((length of (score)) - [1]) of (score)) + [1]) endand another
forever if <(score) > [99]> switch to costume ((letter ((length of (score)) - [2]) of (score)) + [1]) endect. Use as many sprites as you think you'll need.
forever switch to costume ((score) + [1])
Last edited by Splodgey (2012-04-16 14:43:53)
Offline
Do this:
forever switch to costume number ((variable))
Last edited by mythbusteranimator (2012-04-16 14:52:56)
Offline
mythbusteranimator wrote:
Do this:
forever switch to costume (variable)
Offline
mythbusteranimator wrote:
Do this:
forever switch to costume number ((variable))
There will need to be a score of 0.
forever switch to costume ((variable) + [1])And anyway I've already said that.
Last edited by Splodgey (2012-04-17 05:48:33)
Offline
Offline
SD7 wrote:
Splodgey: I'm using your example, and it's working beautifully, but I'd like to understand what it's doing exactly, rather than just copying. What is the [letter [length of score] of score] doing?
That gets the last digit.
Offline
SD7 wrote:
The last digit of the score? And then by adding [letter of score]-[1] it's getting the second-to-last digit, and so on?
Yep.
Offline