Skip to content

Commit

Permalink
Removing Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlizeSerrano5 committed Mar 13, 2024
1 parent 9404b41 commit a532208
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 36 deletions.
4 changes: 0 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ const HP = 999
const MP = 99
const temp_timer = 400

// // initialize a boolean value to check if player has attacked
// let player_attack = false
// // check if it is the player's turn (start off with the player going first)
// let player_turn = true
// let cursors = null


11 changes: 0 additions & 11 deletions src/prefabs/Health.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class HealthBar extends Phaser.GameObjects.Graphics{
scene.add.bitmapText(this.name_pos, this.y + 1, 'font', character.name, 12).setTint(0x1a1200)
scene.add.bitmapText(this.name_pos, this.y, 'font', character.name, 12).setTint(0xa8832a)


this.health_txt = scene.add.bitmapText(this.health_pos, this.y - 8, 'font', character.health, 8)
}

Expand All @@ -49,14 +48,6 @@ class HealthBar extends Phaser.GameObjects.Graphics{
}

draw() {
// this.bar.clear()

// BG of the bar - a container for the health
// Note: should design a container for health
// this.bar.fillStyle(0x000000)
// this.bar.fillRect(this.x, this.y, this.width, this.height);
// health
// this.add.image(this.x, this.y, 'health_bar')

this.bar.fillStyle(0xabaca7)
//#cb3938
Expand All @@ -70,9 +61,7 @@ class HealthBar extends Phaser.GameObjects.Graphics{
this.bar.fillStyle(0xcb3938)
}


var health_width = Math.floor(this.value / 8.7)

this.bar.fillRect(this.x + 2, this.y + 2, health_width, this.height - this.padding)
}
}
7 changes: 1 addition & 6 deletions src/prefabs/Projectile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
class Projectile extends Phaser.Physics.Arcade.Sprite{
constructor(scene, x, y, texture, character){
super(scene, x, y, texture)
// Note: might add health decrease in projectile
// projectile will spawn on player
scene.add.existing(this)

scene.physics.add.existing(this)


// initialize variables
this.moveSpeed = 250
this.character = character
this.startX = this.x
Expand Down Expand Up @@ -65,7 +63,4 @@ class Projectile extends Phaser.Physics.Arcade.Sprite{
return true
}

// update() {
// this.move(scene.enemyX, scene.enemyY)
// }
}
2 changes: 1 addition & 1 deletion src/prefabs/Selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class SelectionMenu extends Phaser.GameObjects.Graphics{
this.cursor_pos = -20

// initializing temporary selection button

//see: https://github.com/phaserjs/examples/blob/master/public/src/game%20objects/text/simple%20text%20button.js
this.container_bg = scene.add.image(x,y - 4, 'container')
this.cursorImage = scene.add.image(x + -36, y + this.cursor_pos, 'cursor').setOrigin(0.5, 0)
Expand Down Expand Up @@ -66,7 +67,6 @@ class SelectionMenu extends Phaser.GameObjects.Graphics{
}

lookChoice(input) {

// selection menu options
// if up and down selected then scroll through options
this.selections[this.current_selection].clearTint()
Expand Down
17 changes: 3 additions & 14 deletions src/scenes/Fighting.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ class Fighting extends Phaser.Scene {
init() {
this.hp = HP
this.mp = MP

// check if it is the player's turn (start off with the player going first)
// boolean to check if it is the player's turn (start off with the player going first)
this.player_turn = true


this.active_players = 3 // Note: with more scenes turn this into a global variable
this.active_enemies = 1 // Note: in future scenes it may change the amount
this.FSM_holder = Array(3).fill(0)
Expand Down Expand Up @@ -72,6 +70,7 @@ class Fighting extends Phaser.Scene {
}
// restart game if game over
if (this.gameOver){
// check gameover condition
if (this.active_enemies == 0){
if (!this.textAdded){
this.add.bitmapText(centerX, centerY, 'font', 'YOU WIN', 20).setOrigin(0.5)
Expand All @@ -80,18 +79,15 @@ class Fighting extends Phaser.Scene {

}
}
// use boolean value to ensure that browser does not lag
if (this.active_players == 0){
// use boolean value to ensure that browser does not lag
if (!this.textAdded){
this.add.bitmapText(centerX, centerY, 'font', 'GAME OVER', 20).setOrigin(0.5)
this.add.bitmapText(centerX, centerY - tileSize, 'font', 'up for menu right to restart', 8).setOrigin(0.5)

this.textAdded = true

}
}


if (up.isDown){
this.music.stop()
this.scene.start('menuScene')
Expand All @@ -110,13 +106,6 @@ class Fighting extends Phaser.Scene {
this.FSM_holder[1].step()
this.FSM_holder[2].step()
this.enemyFSM.step()

// // probably put inside of the character
// if (this.enemy.attacking == false) {
// this.anais.hurt = false
// this.darwin.hurt = false
// this.gumball.hurt = false
// }

if (Phaser.Input.Keyboard.JustDown(space)){
this.selectionMenu.select()
Expand Down

0 comments on commit a532208

Please sign in to comment.