Created
December 26, 2019 23:04
-
-
Save kahilkubilay/f68c36f972fe5519c82745a2b6e70a42 to your computer and use it in GitHub Desktop.
Javascript İle Oyun Yapımı: Nesnelerin Kontrolü - Top
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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