comparing int values in android

Posted by user1183066 on Stack Overflow See other posts from Stack Overflow or by user1183066
Published on 2012-03-25T16:53:12Z Indexed on 2012/03/25 17:30 UTC
Read the original article Hit count: 153

Filed under:
|
|
|
|

I am making an android game that is checking the players health value when this method is being runned. But however, it's not reacting. It doesn't do anything, when the value is less than 3, it shouldn't do anything, but when it is equal to 3, it should run a method. Please help me and thanks SO much in advance! This is the code that i am using:

        private void checkLivesLeftValue() {
        if (livesLeftValue == 3) {
            //Message to display: "You lost!
            onMethod();
        }
        else {
            livesLeftValue = livesLeftValue + 1;
        }
    }

© Stack Overflow or respective owner

Related posts about android

Related posts about application