added update class function

This commit is contained in:
sam
2023-11-28 15:59:46 +01:00
parent 0051d986b7
commit b8ddc4dc05

View File

@@ -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);
}