Negative scoring

I have custom scoring setup fine for a positive score system and am now working on a negative scoring system.

So far I have managed to setup that when the 'Game.Score < 0', I have a minus symbol appear in front of the score actor, using the 'change attribute' for alpha colour from 0 to 1.

Simplest way I could find. Unless there's more of a better solution ?

I have four score actors which displays as 0000 .... I have these actors on display at all times, so when the player get 5 points for a hit it shows 0005, 0030, 0065 etc but if its a miss then -5 points are taken from the score, e.g from zero (0000) the score would now be -0005, -0025, -0060 etc.

The only trouble is that when the game score reaches 0000 and the player has another miss, instead of the score actors displaying -0005 .. it displays -9995 ?

Any ideas as to how to stop it doing this please and show -0005 for example.

I have had a look google / GS site but no joy so far!

I have tried this with the 'display text' and 'display Game.Score' the negative scoring works fine, so it is something I'm missing out when using custom actors/fonts.

Many thanks in advance!
Rob

Comments

  • BrassMonkeysUKBrassMonkeysUK Member, PRO Posts: 33
    edited February 2015

    Further to the above would an index attribute be better to use rather than an integer but it states it doesn't like negative numbers?

    •Index: positive whole numbers, such as 0, 1, 58, 2804. Index attributes can fulfil many of the same roles as Integers, but have the interesting feature of being unable to store a negative number. For instance, an index attribute with a value of 4 that was told to subtract 6 would then have a value of 0, not -2.

    •Integer: whole number values, such as 15, 0, 42, and 5801. Integer is one of the more versatile attributes. A few of the many possible uses are storing the game's score, specifying the number of units to spawn, or keeping track of how many reward objects are left in a scene.

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    @BrassMonkeysUK said:
    The only trouble is that when the game score reaches 0000 and the player has another miss, instead of the score actors displaying -0005 .. it displays -9995 ?

    Yes, that's how it should work - ignore the minus sign, as that's just something you tacked onto the front, so without the minus sign would you expect a descending number sequence to go like this:

    25 - 20 - 15 - 10 - 5 - 0 - 5 - 10 - 15 - 20 - 25 . . . . . etc ?

    This obviously looks like it is starting to increase once it hits 0 rather than continuing to decrease. I'm not sure how your score system is set up but maybe you can have the scoring system 'flip' once passed 0, so scoring a hit gives you -5 points and scoring a miss gives you +5 ponts.

  • BrassMonkeysUKBrassMonkeysUK Member, PRO Posts: 33

    Thanks for the quick reply!

    I did see the abs() function but not being a mathematic or remotely brainy enough to work out how to introduce this function within the code?

    I have the following setup in each number actor:

    constrain attribute
    self.image to floor((game.score%self.div)/(self.div/10))..".png"

    I just added the minus symbol to make it easier to see it was a minus score. From other GS posts I saw, some had used this method.

    I can see that the score is just subtracting 5 from what it reads as 10000 each time as the score displays 9995 as soon as the player gets a 'miss' when at zero. I say 10000 as the score changes from 0 to 9995.

    Ideally I am aiming for it to start from 0 and subtract 5 each time .. -5, -10, -15 and so forth when a player misses.

    So with my setup, the score would look like this, for example, when the player has a constant 'miss' rate from a plus 15 score ..

    0015
    0010
    0005
    0000
    -0005
    -0010
    -0015

    rather than

    0015
    0010
    0005
    0000

    • 9995
    • 9990
    • 9985
  • SocksSocks London, UK.Member Posts: 12,822

    @BrassMonkeysUK said:
    I have the following setup in each number actor:

    constrain attribute
    self.image to floor((game.score%self.div)/(self.div/10))..".png"

    That's how the score is displayed, we're not really interested in that at the moment, we are dealing with how the score is accrued.

    @BrassMonkeysUK said:
    So with my setup, the score would look like this, for example, when the player has a constant 'miss' rate from a plus 15 score ..

    0015
    0010
    0005
    0000
    -0005
    -0010
    -0015

    rather than

    0015
    0010
    0005
    0000

    • 9995
    • 9990
    • 9985

    What you really want is a score that goes like this:

    0015
    0010
    0005
    0000
    0005
    0010
    0015

  • BrassMonkeysUKBrassMonkeysUK Member, PRO Posts: 33

    @Socks said:
    What you really want is a score that
    goes like this:
    0015
    0010
    0005
    0000
    0005
    0010
    0015

    Yes correct ! Is there a way to do that rather than starting at 9995 like it does now please? Or any tips where to start to look?

    Cheers!

  • SocksSocks London, UK.Member Posts: 12,822

    @BrassMonkeysUK said:
    Cheers!

    Let me make you a quick video (I'd make you a demo but you are on a PC) . . .

  • BrassMonkeysUKBrassMonkeysUK Member, PRO Posts: 33

    Ok thankyou !!!

  • SocksSocks London, UK.Member Posts: 12,822

  • BrassMonkeysUKBrassMonkeysUK Member, PRO Posts: 33

    Ur a Legend! I will give that a go in the morning and let you know how I get on! It's nearly 2am now ;)

  • LovejoyLovejoy Member Posts: 2,078

    @Socks said:

    im stuk on the firsrst rule so cant continu

    Fortuna Infortuna Forti Una

  • SocksSocks London, UK.Member Posts: 12,822

    @Lovejoy said:
    im stuk on the firsrst rule so cant continu

    Are you doubtnig my exsellent typing skils ?

  • BrassMonkeysUKBrassMonkeysUK Member, PRO Posts: 33

    @Socks ... works perfect!

    following your video and advice the scoring works fine in the negative with custom fonts!

    floor((abs(game.score)%self.div)/(self.div/10))..".png"

    :)

  • SocksSocks London, UK.Member Posts: 12,822

    @BrassMonkeysUK said:
    Socks ... works perfect!

    following your video and advice the scoring works fine in the negative with custom fonts!

    floor((abs(game.score)%self.div)/(self.div/10))..".png"

    :)

    Excellent I will award myself an extra Weetabix.

  • BrassMonkeysUKBrassMonkeysUK Member, PRO Posts: 33

    ... have a kitkat ! :)

  • SocksSocks London, UK.Member Posts: 12,822

    @BrassMonkeysUK said:
    ... have a kitkat ! :)

    Too racy for me, I only go full kitkat on special occasions.

  • BrassMonkeysUKBrassMonkeysUK Member, PRO Posts: 33

    lol

Sign In or Register to comment.