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