Change player in javascript game [migrated]
- by KLUSTER
Game: onClick startbutton mathrandom for first player who starts the game.
4 Pictures: 2 of it player1 and player2. another 2 Player turn.
need help: on button click next player turn
function game(){
var PlayerTurn;
PlayerTurn=parseInt(Math.random()*2);
if(PlayerTurn==0){PlayerTurn=1;window.document.player1.src="Cache/Player3.PNG";}
else{PlayerTurn=0;window.document.player2.src="Cache/Player4.PNG";}
}
Any help is appreciated.