-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ab6992
commit 4e7fec0
Showing
15 changed files
with
83 additions
and
13 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class Shot { | ||
constructor() { | ||
this.x = game.player.x + game.player.width / 2; | ||
this.y = game.player.y + game.player.height / 3; | ||
this.width = 20; | ||
this.height = 20; | ||
this.damage = 20; | ||
} | ||
draw() { | ||
rect(this.x, this.y, this.width, this.height) | ||
this.x += 19 | ||
} | ||
collision(objectInfo) { | ||
const bulletX = this.x + this.width / 2; | ||
const bulletY = this.y + this.height / 2; | ||
const objectX = objectInfo.x + objectInfo.width / 2; | ||
const objectY = objectInfo.y + objectInfo.height / 2; | ||
|
||
if (dist(bulletX, bulletY, objectX, objectY) > 50) { | ||
return false | ||
} else { | ||
console.log('asd') | ||
game.obstacles.splice(game.obstacles.indexOf(objectInfo)); | ||
return true | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ main { | |
|
||
.menu { | ||
text-align: center; | ||
opacity: 0.3; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
|