generated from nighthawkcoders/teacher_portfolio
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hp-Bar and Lava Rising Significant Changes - Enemies Team (#77)
* Hp Bar * fix * style hp bar with width and center * hp bar style and center and goomba bounce * center bar in proportion * create pixel art island * island fix border * hp bar styling fix (border radius, border style). make canvas better and have hpbar fit canvas for bettter future use * fix center * adding flying island * collison fix * FlyingIsland done! * image fix * Fix scaling and position of Ancient Greece flying island endpoint * lava.js created, z-index modified so that lava is in front of everything, lava successfully works (anvay + yash) * player can die to lava (anvay + yash) * speed of lava optimized for player * Timer for lava to rise * create alert on screen + move text that shows how much time is left * fix flyingIsland collision * make Hp Bar disappear when Boss is died * text styling * player cant jump in boss * beautify lava warning text * 5 hits to kill boss * Fix flag collisons & makes the player jump up when it hits the lava * player HP bar for lava (temporary) * player has three lives (FIX) * player change * fix * Add files via upload --------- Co-authored-by: TianbinLiu <[email protected]> Co-authored-by: Hypernova101 <[email protected]> Co-authored-by: illuminati1618 <[email protected]> Co-authored-by: Mihir Bapat <[email protected]>
- Loading branch information
1 parent
9335fac
commit 6f1bc1f
Showing
19 changed files
with
1,133 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import GameControl from './GameControl.js'; | ||
import GameEnv from './GameEnv.js'; | ||
import JumpPlatform from './JumpPlatform.js'; | ||
|
||
export class BossItem extends JumpPlatform { | ||
constructor(canvas, image, data, xPercentage, yPercentage, name) { | ||
super(canvas, image, data, xPercentage, yPercentage, name); | ||
} | ||
|
||
// Required, but no update action | ||
update() { | ||
super.update(); | ||
} | ||
|
||
collisionAction() { | ||
//collision only detects mario and it only applies to the item block | ||
if (this.collisionData.touchPoints.other.id === "player" && this.name === "itemBlock") { | ||
if (this.relativeX === 0 || this.relativeX === this.canvas.width) { | ||
if (this.relativeX === 0) { | ||
GameControl.startRandomEvent("zombie"); | ||
//console.log("randomEventtriggered", GameControl.randomEventId); | ||
}; | ||
this.relativeX = -1 * this.canvas.width; | ||
} else if (this.relativeX === "") { | ||
this.relativeX = 0; | ||
} | ||
} | ||
} | ||
|
||
// Set platform position | ||
size() { | ||
super.size(); | ||
|
||
} | ||
|
||
// Draw position is always 0,0 | ||
draw() { | ||
super.draw(); | ||
} | ||
} | ||
|
||
export default BossItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import GameObject from './GameObject.js'; | ||
import GameEnv from './GameEnv.js'; | ||
import GameControl from './GameControl.js'; | ||
import BlockPlatform from './BlockPlatform.js'; | ||
|
||
export class FlyingIsland extends BlockPlatform { | ||
constructor(canvas, image, data, xPercentage, yPercentage) { | ||
super(canvas, image, data, xPercentage, yPercentage); | ||
} | ||
|
||
update() { | ||
super.update(); | ||
} | ||
|
||
draw() { | ||
super.draw(); | ||
} | ||
|
||
size() { | ||
// Formula for Height should be on constant ratio, using a proportion of 832 | ||
const scaledWidth = this.canvas.width*0.75; | ||
const scaledHeight = this.canvas.height*0.75; | ||
|
||
const platformX = this.platformX; | ||
const platformY = (GameEnv.bottom - scaledHeight) * this.platformY; | ||
// set variables used in Display and Collision algorithms | ||
this.bottom = platformY; | ||
this.collisionHeight = scaledHeight; | ||
this.collisionWidth = scaledWidth; | ||
//this.canvas.width = this.width; | ||
//this.canvas.height = this.height; | ||
this.canvas.style.width = `${scaledWidth}px`; | ||
this.canvas.style.height = `${scaledHeight}px`; | ||
this.canvas.style.position = 'absolute'; | ||
this.canvas.style.left = `${platformX}px`; | ||
this.canvas.style.top = `${platformY}px`; | ||
} | ||
|
||
} | ||
|
||
|
||
export default FlyingIsland; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.