Skip to content

Instantly share code, notes, and snippets.

@kahilkubilay
Created December 27, 2019 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kahilkubilay/49219efb15e62d8864d4e02f1faaf7c0 to your computer and use it in GitHub Desktop.
Save kahilkubilay/49219efb15e62d8864d4e02f1faaf7c0 to your computer and use it in GitHub Desktop.
Javascript İle Oyun Yapımı: Skor Tablosu
// function gameLoop...
if(parseInt(ball.style.left) <= 0){
if(++scoreRight === 5){
alert('2. oyuncu kazandı.');
scoreRight = 0;
scoreLeft = 0;
document.getElementById('scoreLeft').innerHTML = scoreLeft;
}
document.getElementById('scoreRight').innerHTML = scoreRight;
gameChain();
}
if(parseInt(ball.style.left) + 16 >= window.innerWidth){
if(++scoreLeft === 5){
alert('1. oyuncu kazandı.');
scoreRight = 0;
scoreLeft = 0;
document.getElementById('scoreRight').innerHTML = scoreRight;
}
document.getElementById('scoreLeft').innerHTML = scoreLeft;
gameChain();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment