From a908d79caf92d0b34e7e1368e4a5569592b308ec Mon Sep 17 00:00:00 2001
From: Tyler Donovan <89551524+DonovanTyler@users.noreply.github.com>
Date: Thu, 9 Jun 2022 19:24:27 -0700
Subject: [PATCH] FINALLY FINISHED!
---
.classpath | 6 ++++++
.gitignore | 1 +
.project | 17 +++++++++++++++++
src/boss.js | 22 ++++++++++++++++++----
4 files changed, 42 insertions(+), 4 deletions(-)
create mode 100644 .classpath
create mode 100644 .project
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..fb50116
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index e43b0f9..44d4232 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
.DS_Store
+/bin/
diff --git a/.project b/.project
new file mode 100644
index 0000000..4aa9dff
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ Math-Attack
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/src/boss.js b/src/boss.js
index 6c73f67..edf7fb6 100644
--- a/src/boss.js
+++ b/src/boss.js
@@ -20,7 +20,7 @@ export default class Boss{
};//x and y position
this.height = 50;
this.width = 50;
- this.velocity = {
+ this.velocity = {
x:0,
y:0,
}
@@ -47,14 +47,19 @@ export default class Boss{
let healthBarWidthPct = 15;
let healthBarHeightPct = 5;
this.healthBar = new HealthBar(2, 2, healthBarWidthPct, healthBarHeightPct, this.gameWidth,this.gameHeight);
-
/* setInterval (this.updateHealthBar, 10);*///continuously ensures that health bar on screen is accurate to real health percentage
+ var self = this;
+this.intervalID = setInterval(
+ function() { self.projectileAttack()},
+ 5000);
}
+
+
resetBoss(){
this.health = this.healthMax; // Health is a certain amount of HP
this.healthPct = 100; // Integer out of 100
- this.updateHealthBar();
+ this.updateHealthBar();
this.weapon = weapon; //health as an integer percentage out of 100
this.position = {
x:930,
@@ -68,6 +73,7 @@ export default class Boss{
this.bossBullets = [];
}
+
updateHealthBar()//updates the health bar displayed on screen
{
this.healthBar.setHealthPercent(this.healthPct);
@@ -90,14 +96,22 @@ export default class Boss{
}
projectileAttack(){
+ console.log("Is running");
//console.log('boss attack');
if(this.healthPct >0) {
this.Xdiff=this.position.x-this.player.position.x;
this.Ydiff=this.position.y-this.player.position.y;
this.bossBullets.push(new BossBullet(this.position.x,this.position.y, this.Xdiff, this.Ydiff, this.gameWidth, this.gameHeight, this.player));
+ console.log("is shooting");
}
- }
+else {
+ console.log("is not shooting");
+ clearInterval(bossInterval);
+}
+}
+
+
draw(ctx){
this.healthBar.draw(ctx);