-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Pulled out scoreboard * Pulled ou overlay * Reworked game instantiation
- Loading branch information
Showing
23 changed files
with
380 additions
and
381 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
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 |
---|---|---|
|
@@ -34,4 +34,4 @@ export default { | |
homingDiscColor: 'rgba(255, 255, 255, 1)' | ||
|
||
// Debuging Params | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { Disc } from "./disc.js"; | ||
import { Disc } from "./disc.js" | ||
|
||
export class BeginnerDisc extends Disc { | ||
constructor(unit) { | ||
super('Beginner', unit.gameGrid.config.beginnerDiscColor, unit); | ||
super('Beginner', config.beginnerDiscColor, unit) | ||
|
||
this.baseSpeed = 4; | ||
this.baseSpeed = 4 | ||
} | ||
} |
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 |
---|---|---|
@@ -1,62 +1,62 @@ | ||
import { Vector } from "../vector.js"; | ||
import { Vector } from "../vector.js" | ||
import { Disc } from "./disc.js" | ||
|
||
export class HomingDisc extends Disc { | ||
constructor(unit) { | ||
super('Homing', unit.gameGrid.config.homingDiscColor, unit) | ||
super('Homing', config.homingDiscColor, unit) | ||
|
||
this.baseSpeed = 2; | ||
this.homing = false; | ||
this.baseSpeed = 2 | ||
this.homing = false | ||
} | ||
|
||
Update() { | ||
switch (this.status) { | ||
case this.HELD: | ||
// Follow owner around | ||
this.location = Vector.Clone(this.owner.location); | ||
break; | ||
this.location = Vector.Clone(this.owner.location) | ||
break | ||
case this.RETURNING: | ||
this.Return(); | ||
break; | ||
this.Return() | ||
break | ||
case this.DEADLY: | ||
if (this.homing) { | ||
this.homeInOnPlayer(); | ||
break; | ||
this.homeInOnPlayer() | ||
break | ||
} | ||
case this.BOUNCING: | ||
// Basic Straight Lines | ||
this.location.Add(this.velocity); | ||
break; | ||
this.location.Add(this.velocity) | ||
break | ||
} | ||
|
||
this.checkBounce(); | ||
this.checkBounce() | ||
} | ||
|
||
Thrown(direction) { | ||
// After one second of regular movement, start homing | ||
setTimeout(this.startHoming.bind(this), 1000); | ||
super.Thrown(direction); | ||
setTimeout(this.startHoming.bind(this), 1000) | ||
super.Thrown(direction) | ||
} | ||
|
||
Return() { | ||
this.homing = false; | ||
super.Return(); | ||
this.homing = false | ||
super.Return() | ||
} | ||
|
||
startHoming() { | ||
this.homing = true; | ||
this.homing = true | ||
} | ||
|
||
homeInOnPlayer() { | ||
this.velocity = new Vector([0, 0]); | ||
this.velocity = new Vector([0, 0]) | ||
|
||
const playerForce = Vector.SubFactory(this.gameGrid.player.location, this.location); | ||
playerForce.Normalize(); | ||
playerForce.Mul(this.baseSpeed + this.speedModifier); | ||
const playerForce = Vector.SubFactory(this.gameGrid.player.location, this.location) | ||
playerForce.Normalize() | ||
playerForce.Mul(this.baseSpeed + this.speedModifier) | ||
|
||
this.velocity.Add(playerForce); | ||
this.velocity.Limit(this.baseSpeed + this.speedModifier); | ||
this.velocity.Add(playerForce) | ||
this.velocity.Limit(this.baseSpeed + this.speedModifier) | ||
|
||
this.location.Add(this.velocity); | ||
this.location.Add(this.velocity) | ||
} | ||
} |
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.