Skip to content

Instantly share code, notes, and snippets.

@kahilkubilay
Created December 27, 2019 10:38
Show Gist options
  • Save kahilkubilay/27ba9798612f697daaccaa4b3727197f to your computer and use it in GitHub Desktop.
Save kahilkubilay/27ba9798612f697daaccaa4b3727197f to your computer and use it in GitHub Desktop.
Javascript İle Oyun Yapımı: Skor Tablosu
//gameLoop function....
if(parseInt(ball.style.left) <= 0){
scoreRight++;
document.getElementById('scoreRight').innerHTML = scoreRight;
gameChain();
}
if(parseInt(ball.style.left) + 16 >= window.innerWidth){
scoreLeft++;
document.getElementById('scoreLeft').innerHTML = scoreLeft;
gameChain();
}
}
function gameChain(){
ball.style.top = window.innerHeight/2 + 'px';
ball.style.left = (window.innerWidth/2) - (16/2) + 'px';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment