added third patern (multiple bullets at once)
This commit is contained in:
14
web/game.js
14
web/game.js
@@ -35,6 +35,7 @@ let direction;
|
||||
let framerate = 120;
|
||||
let hasMoved = false;
|
||||
let time = 0;
|
||||
let shotPoint = 0;
|
||||
|
||||
//let myBullet = new bullet();
|
||||
// the function setup() is called once when the page is loaded
|
||||
@@ -43,6 +44,7 @@ function setup() {
|
||||
|
||||
createCanvas(width, height);
|
||||
frameRate(framerate);
|
||||
angleMode(DEGREES);
|
||||
|
||||
// disable the outline of shapes
|
||||
Movementloop()
|
||||
@@ -196,7 +198,7 @@ function randomAttackPattern(){
|
||||
|
||||
function spawnRandomBullet(){
|
||||
|
||||
let patern = random([1,2]);
|
||||
let patern = random([3]);
|
||||
if (patern == 1) {
|
||||
nextAttack = random([1, 2, 3, 4]);
|
||||
text(nextAttack, 30, 50);
|
||||
@@ -227,5 +229,15 @@ function spawnRandomBullet(){
|
||||
shotPosY = bounceY;
|
||||
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved));
|
||||
}
|
||||
if (patern == 3) {
|
||||
shotPosX = 500;
|
||||
shotPosY = 100;
|
||||
shotPoint = 0;
|
||||
for (let i = 0; i < 50; i++) {
|
||||
shotPoint = shotPoint + 50;
|
||||
|
||||
bullets.push(new bullet(0, shotPoint, radius, shotSpeed, shotPosX, shotPosY, hasMoved));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user