Skip to content

Instantly share code, notes, and snippets.

@kahilkubilay
Created December 26, 2019 23:04
Show Gist options
  • Save kahilkubilay/f68c36f972fe5519c82745a2b6e70a42 to your computer and use it in GitHub Desktop.
Save kahilkubilay/f68c36f972fe5519c82745a2b6e70a42 to your computer and use it in GitHub Desktop.
Javascript İle Oyun Yapımı: Nesnelerin Kontrolü - Top
// top sağ ve sol çubuklara çarparsa, Y ekseninde geri seksin
if(parseInt(ball.style.left) <= 0 + 16 && parseInt(ball.style.top) >= parseInt(stickLeft.style.top) && parseInt(ball.style.top) <= parseInt(stickLeft.style.top) + 85){
ballLeft *= -1;
}else if(parseInt(ball.style.left) + 16 >= window.innerWidth - 12 && parseInt(ball.style.top) >= parseInt(stickRight.style.top) && parseInt(ball.style.top) <= parseInt(stickRight.style.top) + 85){
ballLeft *= -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment