Score sets to the 10's digit. EDIT: SOLVED

GnomerGnomer Member Posts: 292
edited January 2012 in Working with GS (Mac)
So i have a score function in my game, it works perfectly in the game but when the game ends and you got to the game over page, the 10's digit always remembers what you got on your first try. For example, on first go you get 180, second go if you were to get 234, it would set it to 284 because 8 was the digit from before. What is wrong and how can I fix this?

Sorry if i wasn't very clear,

Thanks :)

Comments

  • CloudsClouds Member Posts: 1,599
    edited January 2012
    Hard to know without seeing how you have coded this, there are many many different ways of amassing scores, and as many ways of displaying scores, no one really knows how you have coded yours - only you, and so far you are keeping it secret !?

    : )

    I think for these kinds of questions you need to at least give people a few clues, even if it's just the very basics of how you have this set up, otherwise it's all a bit: "I have a box moving and it hits this other guy but is meant to explode and doesn't do it properly, what am I doing wrong ?"

    I bet you with people like Tshirtbooth around a screen shot of the offending code would be enough for him to spot the mistake in 30 seconds, but without knowing what is going on in your project people can only guess.

    Here's my guess, your problem is with the way you have set up the 3 attributes that control where the 0 is added to the final score from level 1.

    How did I do ?

    : P
  • GnomerGnomer Member Posts: 292
    okay, so I have 1 actor. I have dragged this actor into my scene 4 times, so I can have a score of up to 9999. I have 10 different images 0-9 so that they can display any digit.

    The coding for each is as follows:

    Constrain attribute: self.image :floor(( game.Highscore % self.Div )/( self.Div /10))

    In the units I have Div 10, 10's I have Div 100, 100's I have Div 1000 and 1000's I have Div 10000.

    The coding for the score is: After gamestart is true, every 0.2 seconds change game.score to game.score +1

    The coding for the highscore is: When game.score > game.highscore, change attribute: game.highscore to game.score. Then save attribute game.highscore with key highscore.

    Hope this helps :)

    PS the score is made up of images not the set fonts.
Sign In or Register to comment.