how to switch between 2 player | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to switch between 2 player

basic game

29th Nov 2016, 8:00 PM
Michael Charbbie Fuentes
Michael Charbbie Fuentes - avatar
4 Answers
0
just create 2 player objects, an if statement and copy paste just changing the object referenced. not the most beautiful way. but works
30th Nov 2016, 12:53 AM
Gustavo Luis
Gustavo Luis - avatar
0
can you give me some code idea. because i tried to use this code but its not working char player = x; if (player == 'x'){ some code.... player = 'y'; else if (player == y){ some code... player = 'x'; }
30th Nov 2016, 2:24 AM
Michael Charbbie Fuentes
Michael Charbbie Fuentes - avatar
0
i tried to use this also int player= 0; if (player== 0){ some code... player++; } else if (player == 1){ some code... player--; }
30th Nov 2016, 2:27 AM
Michael Charbbie Fuentes
Michael Charbbie Fuentes - avatar
0
thanks for replying sir....
30th Nov 2016, 2:28 AM
Michael Charbbie Fuentes
Michael Charbbie Fuentes - avatar