some sound, death

This commit is contained in:
rsninja722 2020-04-20 17:57:58 -04:00
parent db800eea27
commit e7909ad910
15 changed files with 67 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

43
docs/assets/js/UI/dead.js Normal file
View File

@ -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;
}
}

View File

@ -85,10 +85,6 @@ function drawPlayingUI() {
curCtx.globalAlpha = 1;
}
//UI for pause screen
function drawPausedUI() {
}
//UI for game end
function drawEndUI() {
}

View File

@ -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:

View File

@ -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");
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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)
}

View File

@ -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";
}
}

View File

@ -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

Binary file not shown.

BIN
docs/assets/sounds/dead.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -76,6 +76,7 @@ Matthew West
<script src="assets/js/titleScreen/titleScreen.js"></script>
<script src="assets/js/UI/ui.js"></script>
<script src="assets/js/UI/dead.js"></script>
<script src="assets/js/transition/transition.js"></script>
<!-- Webpage -->