Defined bullet class
This commit is contained in:
@@ -25,6 +25,7 @@ let nextAttack;
|
|||||||
|
|
||||||
let time = 0;
|
let time = 0;
|
||||||
|
|
||||||
|
let myBullet = new bullet();
|
||||||
// the function setup() is called once when the page is loaded
|
// the function setup() is called once when the page is loaded
|
||||||
function setup() {
|
function setup() {
|
||||||
// create a canvas element and append it to the body
|
// create a canvas element and append it to the body
|
||||||
@@ -136,6 +137,7 @@ function draw() {
|
|||||||
keyPressed();
|
keyPressed();
|
||||||
life();
|
life();
|
||||||
// draw background
|
// draw background
|
||||||
|
myBullet.draw();
|
||||||
background(0, 0, 0, 100);
|
background(0, 0, 0, 100);
|
||||||
if (!(lives == 0)) {
|
if (!(lives == 0)) {
|
||||||
// draw player
|
// draw player
|
||||||
@@ -176,4 +178,4 @@ function draw() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user