added update class function
This commit is contained in:
@@ -106,7 +106,7 @@ function setup(){
|
|||||||
createCanvas(1250, 600);
|
createCanvas(1250, 600);
|
||||||
frameRate(244);
|
frameRate(244);
|
||||||
// disable the outline of shapes
|
// disable the outline of shapes
|
||||||
myBullet = new bullet();
|
myBullet = new bullet(playerPosX, playerPosY, 10, 20);
|
||||||
|
|
||||||
noStroke();
|
noStroke();
|
||||||
}
|
}
|
||||||
@@ -114,10 +114,10 @@ function setup(){
|
|||||||
// the function draw() is called every frame
|
// the function draw() is called every frame
|
||||||
function draw(){
|
function draw(){
|
||||||
keyPressed()
|
keyPressed()
|
||||||
myBullet.draw(playerPosX, playerPosY, 10, 5);
|
|
||||||
// clear the background with a transparent black color
|
// clear the background with a transparent black color
|
||||||
background(0,0,0,10);
|
background(0,0,0,10);
|
||||||
|
myBullet.draw();
|
||||||
|
myBullet.update();
|
||||||
// draw a circle at the mouse position
|
// draw a circle at the mouse position
|
||||||
circle(playerPosX, playerPosY, radius);
|
circle(playerPosX, playerPosY, radius);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user