java - Libgdx: Scoring points basic -


i trying code score system increments whenever collision occurs between enemy , player. initialize score 100 , incremented once collision detected, means the old score 100 , new 1 101. happen old score 0 while new score 100. can me debut code. thank you.

here code:

code in bpaste

when call getscore() first time, hasn't been initialized yet, returns 0.

what scoreincrement() method add 100 tempscore, added score (which 100).

if understood intentions correctly, use this:

//initialize score 100 private int score = 100;  //method incrementing score 1 public void scoreincrement() {     score++; }  //score getter public int getscore() {     return score; } 

Comments

  1. Hello admin,

    I attempting code score framework increases at whatever point impact happens between foe, player. instate score 100, increased once impact identified, implies the old score 100, new 1 101.

    Regards,
    Thanks

    RITU





    ReplyDelete
  2. Hello admin,

    I attempting code score framework increases at whatever point effect occurs between foe, participant. Instate score a hundred, expanded once effect recognized, implies the antique score 100, new 1 101.

    Regards,
    Thankskomal


    ReplyDelete

Post a Comment

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -