Sign In Register

How can we help you today?

Start a new topic
Answered

challenge winner determination

 in my game , when i take the last turn i need to determine wich player have won the match , or even if the match has been a draw , so when every turn is done im doing this on taketurn last time called


function end_game(){
    if (player_one_score > player_two_score){
        challenge.winChallenge(player_one_id);
    }else if (player_one_score < player_two_score){
        challenge.winChallenge(player_two_id);
    }else if(player_one_score == player_two_score){
        challenge.drawChallenge();
    }
}


i think this will be doing great until i noticed that challenge.winChallenge() needs a Player to be passed , not just the ID.ç


I've searched all across the API reference and i coud'nt find how to acomplish that , so any help will be apreciated.


Thanks.


Best Answer

Hello joaquin sanchez,

As per GameSparks documentation you can use:

challenge.winChallenge(Spark.loadPlayer(player_one_id));

Regards,

Mantas


Answer

Hello joaquin sanchez,

As per GameSparks documentation you can use:

challenge.winChallenge(Spark.loadPlayer(player_one_id));

Regards,

Mantas

it worked , thanks for fast reply :D

 

Login to post a comment