Merge branch 'main' of https://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-2/cuujooceevii61
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class bullet {
|
||||
constructor(targetx, targety, radius, speed, shotPosX, shotPosY, hasMoved) { // Add hasMoved parameter
|
||||
constructor(targetx, targety, radius, speed, shotPosX, shotPosY, hasMoved, angle) { // Add hasMoved parameter
|
||||
this.angle = radians(angle);
|
||||
this.targetx = targetx;
|
||||
this.targety = targety;
|
||||
this.x = shotPosX;
|
||||
@@ -18,6 +19,8 @@ class bullet {
|
||||
this.projectile = createVector(this.x, this.y);
|
||||
this.direction = createVector(this.targetx - this.projectile.x, this.targety - this.projectile.y);
|
||||
this.direction.normalize();
|
||||
|
||||
this.direction.rotate(this.angle);
|
||||
}
|
||||
|
||||
draw() {
|
||||
|
Reference in New Issue
Block a user