Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Dec 15, 2024
1 parent dbbfcba commit 96f3d4c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions html5/js/kubeinvaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,10 @@ window.setInterval(function draw() {
drawRocket();
}

if (globalState.get('x') + globalState.get('dx') > canvas.width - ballRadius || globalState.get('x') + globalState.get('dx') < ballRadius) {
if (globalState.get('x') + globalState.get('dx') > canvas.width - globalState.get('ballRadius') || globalState.get('x') + globalState.get('dx') < globalState.get('ballRadius')) {
globalState.set('dx') = -globalState.get('dx');
}
if (globalState.get('y') + globalState.get('dy') > canvas.height - ballRadius || globalState.get('y') + globalState.get('dy') < ballRadius) {
if (globalState.get('y') + globalState.get('dy') > canvas.height - globalState.get('ballRadius') || globalState.get('y') + globalState.get('dy') < globalState.get('ballRadius')) {
globalState.set('dy') = -globalState.get('dy');
}

Expand Down

0 comments on commit 96f3d4c

Please sign in to comment.