Interpolating Score question

MeaningfulGamesMeaningfulGames Member, PRO Posts: 171
edited September 2012 in Working with GS (Mac)
Hi community,

I followed T-shirt booth's tutorial on how to use your own custom font numbers and link that with your score. My game is working that just fine, but the thing is, i want to make the numbers which are unused to be hidden.

for example, it displays "0000" at the beginning of the game. slowly as the score builds up, the div attribute allows the placeholder to work, eventually going up to a score of say "0389".

I'd like to have it not show the 1000s, 100s or 10s column at the beginning (just a score shown as "0") and then when the score is right then the new number shows, ie. hiding the zeroes.

Is there anyway to do this? I've tried messing around with colour, images, transparency, and the such with no luck. it may be possible to have a different actor for every "0" instead of having one actor pasted 4 times and edited to make the "div" 10, 100, 1000 etc. like i'm doing now, but having so many actors would lose out on performance.

any ideas?

Comments

  • 3itg3itg Member, PRO Posts: 382
    edited September 2012
    When I wanted the same effect, I made an actor that spawned my numbers. and a rule that said when score is less than or equal to 9, spawn "0 placeholder". if less than or equal to 99 but greater than 9, spawn 00 placeholder, if less than or equal to 999 but greater than 99, spawn a 000 placeholder.
    I made unique actors for each integer of the score. (the placeholders)
    on each of those actors, I used the same rules I just described, except on the actors these rules are only used to move the actors left or right based on how many digits in the score.

    EDIT: I read my explanation and decided that I failed...
    Heres an image that may explain the same thing better.
    image
    Notice that each actor is spawning +16 to the right of the previous.
    And in the pictured method I destroy my score actors when the score reaches 1000
    (because the rule spawns the actor again, just in a different place. you could also just add a "move" rule to each actor as I was describing in my initial response, and avoid spawn & destroy.)
  • Mr HansonMr Hanson Member Posts: 94
    Hello @Vincam

    You could do what @3itg said about if score is greater than self.

    You could just place them where you want. Change their alpha to zero. Then make a self.attribute for the score actors. And say if score is great than self.attribute than change alpha to one.

    For example
    For your tens column actor. Change alpha to 0.
    Create self.score and change it to 9. Then create rule where if game score is greater than self.score (9) then change alpha to 1.

    Hope this helps.

    All the best
    JobApp




  • MeaningfulGamesMeaningfulGames Member, PRO Posts: 171
    Thanks a lot @3itg - I'll implement the code and see if it works.
  • MeaningfulGamesMeaningfulGames Member, PRO Posts: 171
    @3itg I tried your method and it worked! But then I playtested and I saw a significant reduction is memory performance... I tried JonApp's and it worked too, and I found it took less of a toll. They are both valid solutions, thanks all.
  • Mr HansonMr Hanson Member Posts: 94
    @Vincam

    Good to hear that they both worked for you.
    Good luck in making your game :)
    If you need help with anything you can always send me a PM and i will try and help!

    All the best
    JonApp
  • UtopianGamesUtopianGames Member Posts: 5,692
    I would 2nd the alpha to 0 method (it's what i always use).

    Darren.
Sign In or Register to comment.