diff --git a/docs/assets/images/snap1.png b/docs/assets/images/snap1.png new file mode 100644 index 0000000..fb4bc00 Binary files /dev/null and b/docs/assets/images/snap1.png differ diff --git a/docs/assets/js/UI/dead.js b/docs/assets/js/UI/dead.js new file mode 100644 index 0000000..f25c6ba --- /dev/null +++ b/docs/assets/js/UI/dead.js @@ -0,0 +1,43 @@ +function deadUI() { + rect(cw/2,ch/2,cw,ch,"black"); + text("Mike Died", 300, 50, "#992929", 4); + text("maybe try to keep your heart beating, also it doesn't hurt to breath occasionally ", 250, 100, "white", 2, 400); + + img(sprites["buttonBig" + (rectpoint({ x: 400, y: 550, w: 300, h: 50 }, mousePos) ? "Hover" : "")], 400, 550, 0, 2, 2); + text("time travel back", 260, 540, "#403826", 3); +} + +function handleDead() { + + if(rectpoint({ x: 400, y: 550, w: 300, h: 50 }, mousePos) && mousePress[0]) { + soundAssets.click.play(); + player = new Player(constants.player.defaultX, constants.player.defaultY); + + // why does this stop the legs from glitching on the first step??? + player.rightLeg.angle = -pointTo({ x: player.rightLeg.x2, y: player.rightLeg.y2 }, player.hipRight); + player.leftLeg.angle = pointTo({ x: player.leftLeg.x2, y: player.leftLeg.y2 }, player.hipLeft); + player.moveLeg(); + + Objectives = []; + Objectives.push(new Objective(-140,108,60,300,"cereal",function(){console.log("%c cereal obtained 😎","font-size:200%;");tutState = tutorialStates.getMail;})); + Objectives.push(new Objective(-740,156,50,50,"box",function(){console.log("%c the entire mailbox obtained 😎","font-size:200%;");player.holdingBox = true;})); + + playingUIOffsets = { + heart: 100, + breath: 100, + blink: 100 + }; + + tutState = tutorialStates.selectLeg; + + breath = 200; + pressure = 55; + fullBreathTimer = 0; + noBreathTimer = 0; + heartBeat = false; + currentBreathMode = breathMode.inhale; + eyeDryness = 0; + + globalState = globalStates.levelTransition; + } +} \ No newline at end of file diff --git a/docs/assets/js/UI/ui.js b/docs/assets/js/UI/ui.js index 87fe9b2..a831a8d 100644 --- a/docs/assets/js/UI/ui.js +++ b/docs/assets/js/UI/ui.js @@ -85,10 +85,6 @@ function drawPlayingUI() { curCtx.globalAlpha = 1; } -//UI for pause screen -function drawPausedUI() { -} - //UI for game end function drawEndUI() { } diff --git a/docs/assets/js/index.js b/docs/assets/js/index.js index 1fb6937..c86b7d3 100644 --- a/docs/assets/js/index.js +++ b/docs/assets/js/index.js @@ -50,7 +50,7 @@ var globalStates = { titleScreen: 0, levelTransition: 1, playing: 2, - paused: 3, + dead: 3, end: 4, building: 5 }; @@ -72,9 +72,9 @@ function update() { handlePlaying(); player.update(); break; - // paused - case globalStates.paused: - + // dead + case globalStates.dead: + handleDead(); break; // end case globalStates.end: @@ -109,9 +109,9 @@ function draw() { case globalStates.playing: drawPlaying(); break; - // paused - case globalStates.paused: - + // dead + case globalStates.dead: + break; // end case globalStates.end: @@ -139,9 +139,9 @@ function absoluteDraw() { case globalStates.playing: drawPlayingUI(); break; - // paused - case globalStates.paused: - drawPausedUI(); + // dead + case globalStates.dead: + deadUI(); break; // end case globalStates.end: diff --git a/docs/assets/js/player/player.js b/docs/assets/js/player/player.js index 1a9e73a..9e9d978 100644 --- a/docs/assets/js/player/player.js +++ b/docs/assets/js/player/player.js @@ -38,6 +38,8 @@ Player.prototype.getLockedLeg = function(){ } Player.prototype.die = function() { + soundAssets.dead.play(); + globalState = globalStates.dead; console.warn("player is big ded, rip"); } diff --git a/docs/assets/js/playing/particles.js b/docs/assets/js/playing/particles.js index c564e41..f8c0391 100644 --- a/docs/assets/js/playing/particles.js +++ b/docs/assets/js/playing/particles.js @@ -6,7 +6,7 @@ class Particle { var angle = rand(0,2262)/360; var speed = rand(5,10); this.vel = {x:Math.cos(angle) * speed,y:Math.sin(angle) * speed}; - this.timer = rand(25,50); + this.timer = rand(50,150); } } diff --git a/docs/assets/js/playing/playing.js b/docs/assets/js/playing/playing.js index ebada01..d92a7bb 100644 --- a/docs/assets/js/playing/playing.js +++ b/docs/assets/js/playing/playing.js @@ -91,7 +91,7 @@ function drawPlaying() { imgIgnoreCutoff(sprites.epic,0,0); imgIgnoreCutoff(sprites.post,-740,156,0,4,4); - imgIgnoreCutoff(sprites.chandelier,770,-235,0,4,4); + imgIgnoreCutoff(sprites.chandelier,770,-300,0,4,4); if(boxOnTable) { imgIgnoreCutoff(sprites.boxNoOutline,-140,116,0,4,4); diff --git a/docs/assets/js/sounds/sounds.js b/docs/assets/js/sounds/sounds.js index cca2d6a..4b8f1b8 100644 --- a/docs/assets/js/sounds/sounds.js +++ b/docs/assets/js/sounds/sounds.js @@ -23,6 +23,8 @@ let soundAssetMap = { "inhale": "./assets/sounds/breathing/inhale.mp3", "exhale": "./assets/sounds/breathing/exhale.mp3", "cough": "./assets/sounds/cough.mp3", + "dead": "./assets/sounds/dead.mp3", + "click": "./assets/sounds/click.mp3", "backingtrack": "./assets/sounds/backingtrack.wav" } @@ -39,6 +41,8 @@ let soundAssets = { inhale: new SoundSnippet("inhale", audioAssetType.sfx), exhale: new SoundSnippet("exhale", audioAssetType.sfx), cough: new SoundSnippet("cough", audioAssetType.sfx), + dead: new SoundSnippet("dead", audioAssetType.sfx), + click: new SoundSnippet("click", audioAssetType.sfx), backingtrack: new SoundSnippet("backingtrack", audioAssetType.bgm) } diff --git a/docs/assets/js/titleScreen/titleScreen.js b/docs/assets/js/titleScreen/titleScreen.js index fb1a1cb..20607a8 100644 --- a/docs/assets/js/titleScreen/titleScreen.js +++ b/docs/assets/js/titleScreen/titleScreen.js @@ -28,6 +28,7 @@ function handleMainScreen() { if (!firstFrame) { if (mousePress[0]) { if (rectpoint({ x: 400, y: 200, w: 300, h: 50 }, mousePos)) { + soundAssets.click.play(); globalState = globalStates.levelTransition; // Play the bgm @@ -35,6 +36,7 @@ function handleMainScreen() { } if (rectpoint({ x: 400, y: 550, w: 300, h: 50 }, mousePos)) { + soundAssets.click.play(); titleScreenState = "credits" timer = 0; } @@ -54,6 +56,7 @@ function handleCredits() { elemStyle.top = canvases.cvs.offsetTop + 20 + "px"; if (rectpoint({ x: 80, y: 550, w: 140, h: 50 }, mousePos) && mousePress[0]) { + soundAssets.click.play(); titleScreenState = "main"; } } diff --git a/docs/assets/js/transition/transition.js b/docs/assets/js/transition/transition.js index 4d8cf2a..76018eb 100644 --- a/docs/assets/js/transition/transition.js +++ b/docs/assets/js/transition/transition.js @@ -6,7 +6,7 @@ function handleTransition(){ // Calculates alpha until its zero if(currentAlpha > 0){ - currentAlpha -= .005; + currentAlpha -= .01; } @@ -39,7 +39,7 @@ function drawLevelTransitionUI() { // draws background sprites drawWorldBlocks(); imgIgnoreCutoff(sprites.epic,0,0); - imgIgnoreCutoff(sprites.chandelier,770,-235,0,4,4); + imgIgnoreCutoff(sprites.chandelier,770,-300,0,4,4); player.draw(); // sets alpha to calculated alpha for black diff --git a/docs/assets/sounds/click.mp3 b/docs/assets/sounds/click.mp3 new file mode 100644 index 0000000..f22f933 Binary files /dev/null and b/docs/assets/sounds/click.mp3 differ diff --git a/docs/assets/sounds/dead.mp3 b/docs/assets/sounds/dead.mp3 new file mode 100644 index 0000000..b074f7a Binary files /dev/null and b/docs/assets/sounds/dead.mp3 differ diff --git a/docs/assets/sounds/hover.mp3 b/docs/assets/sounds/hover.mp3 new file mode 100644 index 0000000..7adac27 Binary files /dev/null and b/docs/assets/sounds/hover.mp3 differ diff --git a/docs/assets/sounds/hover.wav b/docs/assets/sounds/hover.wav new file mode 100644 index 0000000..3a7b6bd Binary files /dev/null and b/docs/assets/sounds/hover.wav differ diff --git a/docs/index.html b/docs/index.html index 83f66b0..ae30903 100644 --- a/docs/index.html +++ b/docs/index.html @@ -76,6 +76,7 @@ Matthew West +