+ 1

Make a game with turns

Hi all! I am looking to some ideas to code a game. Is a simple game for 2 players. I have to think how to code the game not the code itself. Example a guess the number game: Player 1 first chance, then player 2 repeat till one player guess the number. Is not about how to guess the number I need help thinking in the player turns. Thanks!

21st Apr 2017, 4:11 PM
alvaro mesa
alvaro mesa - avatar
2 Answers
+ 14
Have a counter for the number of turns. So it starts off like this: var turn = 1; loop{ if(turn%2==0) playerOneGuess(); else playerTwoGuess(); turn++; } So keep looping until a player guesses correctly.
22nd Apr 2017, 4:24 AM
Jafca
Jafca - avatar
+ 1
Thank you I will try to use that to make a 3 players game. One select the number and the other 2 try to guess.
22nd Apr 2017, 9:14 AM
alvaro mesa
alvaro mesa - avatar