|
|
|
|
@ -29,8 +29,6 @@ window.addEventListener("DOMContentLoaded", function() {
@@ -29,8 +29,6 @@ window.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
this.isAlive = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update() { |
|
|
|
|
this.vx = 0; |
|
|
|
|
if (this.keys.h) { |
|
|
|
|
@ -98,6 +96,10 @@ window.addEventListener("DOMContentLoaded", function() {
@@ -98,6 +96,10 @@ window.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
const legLength = crouch ? 20 : 25; |
|
|
|
|
if (crouch) y += 15; // shift down a touch so crouch looks grounded
|
|
|
|
|
|
|
|
|
|
// Set drawing styles
|
|
|
|
|
ctx.strokeStyle = "black"; |
|
|
|
|
ctx.fillStyle = "black"; |
|
|
|
|
ctx.lineWidth = 2; |
|
|
|
|
|
|
|
|
|
// head
|
|
|
|
|
ctx.beginPath(); |
|
|
|
|
@ -284,9 +286,6 @@ window.addEventListener("DOMContentLoaded", function() {
@@ -284,9 +286,6 @@ window.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
|
|
|
|
|
this.time = 0; |
|
|
|
|
this.players = { |
|
|
|
|
"player": new StickFigure(10, 1, "player", this.canvas), |
|
|
|
|
"player1": new StickFigure(100, 1, "player1", this.canvas) |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
this.pageData = this._getPageData(); |
|
|
|
|
|
|
|
|
|
@ -309,7 +308,7 @@ window.addEventListener("DOMContentLoaded", function() {
@@ -309,7 +308,7 @@ window.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
|
|
|
|
|
start() { |
|
|
|
|
if (this._started) return; |
|
|
|
|
this.started = true; |
|
|
|
|
this._started = true; // FIXED: was "this.started = true"
|
|
|
|
|
this._stopped = false; |
|
|
|
|
|
|
|
|
|
document.addEventListener("keydown", this._onKeyDown); |
|
|
|
|
@ -398,7 +397,6 @@ window.addEventListener("DOMContentLoaded", function() {
@@ -398,7 +397,6 @@ window.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
|
|
|
|
|
playerArray.forEach(player => { |
|
|
|
|
player.draw(this.ctx, this.time); // Call the draw method for each player
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
requestAnimationFrame(this.loop) |
|
|
|
|
|