lung and chandelier

This commit is contained in:
rsninja722 2020-04-20 02:28:48 -04:00
parent b9d758f417
commit a7de63582b
11 changed files with 46 additions and 17 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

View File

@ -40,8 +40,17 @@ function drawEndUI() {
*/
function respiratoryUI(x, y, width, height) {
cartesianRect(x, y, width, height, "rgb(" + noBreathTimer / 180 * 255 + "," + 0 + "," + 0 + ")");
cartesianRect(x, y + (height - breath / constants.lifeFuncs.breath.fullBreath * height), width, breath / constants.lifeFuncs.breath.fullBreath * height, "rgb(" + 255 + "," + (255 - fullBreathTimer / 180 * 255) + "," + (255 - fullBreathTimer / 180 * 255) + ")");
// cartesianRect(x, y, width, height, "rgb(" + noBreathTimer / 180 * 255 + "," + 0 + "," + 0 + ")");
// cartesianRect(x, y + (height - breath / constants.lifeFuncs.breath.fullBreath * height), width, breath / constants.lifeFuncs.breath.fullBreath * height, "rgb(" + 255 + "," + (255 - fullBreathTimer / 180 * 255) + "," + (255 - fullBreathTimer / 180 * 255) + ")");
var color = currentBreathMode === breathMode.inhale ? "rgb(" + fullBreathTimer + ",0,0)" : "rgb(" + noBreathTimer + ",0,0)";
rect(cw - 275, ch - 46 + playingUIOffsets.breath,70,70,color);
img(sprites.lungBack,cw - 275, ch - 46 + playingUIOffsets.breath);
img(sprites.lungCover,cw - 275, ch - 46 + playingUIOffsets.breath);
img(sprites.lungs,cw - 275, ch - 46 + playingUIOffsets.breath, 0, 1.5 + breath / 400, 1.5 + breath / 300 );
}
/***

View File

@ -24,7 +24,13 @@ images = [
"playerBody.png",
"playerLeg.png",
"playerArm.png",
"playerHead.png"
"playerHead.png",
"playerFoot.png",
"playerFootActive.png",
"lungs.png",
"lungCover.png",
"lungBack.png",
"chandelier.png"
];
audio = [

View File

@ -88,18 +88,18 @@ Player.prototype.update = function() {
}
// god mode
// if(keyDown[k.w]) {
// this.y-=5;
// }
// if(keyDown[k.s]) {
// this.y+=5;
// }
// if(keyDown[k.a]) {
// this.x-=5;
// }
// if(keyDown[k.d]) {
// this.x+=5;
// }
if(keyDown[k.w]) {
this.y-=5;
}
if(keyDown[k.s]) {
this.y+=5;
}
if(keyDown[k.a]) {
this.x-=5;
}
if(keyDown[k.d]) {
this.x+=5;
}
var halfPI = pi/2;
if(this.leftArm.angle > halfPI) {
@ -326,8 +326,20 @@ Player.prototype.draw = function() {
img(sprites.playerLeg,(this.leftLeg.x+this.leftLeg.x2)/2,(this.leftLeg.y+this.leftLeg.y2)/2,this.leftLeg.angle+pi/2,4,4);
img(sprites.playerLeg,(this.rightLeg.x+this.rightLeg.x2)/2,(this.rightLeg.y+this.rightLeg.y2)/2,this.rightLeg.angle+pi/2,4,4);
if(this.shouldMoveLeg) {
if(this.legSelected === "R") {
var active = collidingWithWorld({x: this.rightLeg.x2, y: this.rightLeg.y2, w:8, h:8});
img(sprites.playerFoot,this.leftLeg.x2,this.leftLeg.y2,0,-4,4);
img(sprites["playerFoot" + (active ? "Active" : "")],this.rightLeg.x2,this.rightLeg.y2,0,4,4);
} else {
var active = collidingWithWorld({x: this.leftLeg.x2, y: this.leftLeg.y2, w:8, h:8});
img(sprites["playerFoot" + (active ? "Active" : "")],this.leftLeg.x2,this.leftLeg.y2,0,-4,4);
img(sprites.playerFoot,this.rightLeg.x2,this.rightLeg.y2,0,4,4);
}
} else {
img(sprites.playerFoot,this.leftLeg.x2,this.leftLeg.y2,0,-4,4);
img(sprites.playerFoot,this.rightLeg.x2,this.rightLeg.y2,0,4,4);
}
}
// https://github.com/scottglz/distance-to-line-segment/blob/master/index.js

View File

@ -82,6 +82,7 @@ function drawPlaying() {
imgIgnoreCutoff(sprites.epic,0,0);
imgIgnoreCutoff(sprites.post,-740,156,0,4,4);
imgIgnoreCutoff(sprites.chandelier,770,-235,0,4,4);
if(boxOnTable) {
imgIgnoreCutoff(sprites.boxNoOutline,-140,116,0,4,4);

View File

@ -39,6 +39,7 @@ function drawLevelTransitionUI() {
// draws background sprites
drawWorldBlocks();
imgIgnoreCutoff(sprites.epic,0,0);
imgIgnoreCutoff(sprites.chandelier,770,-235,0,4,4);
player.draw();
// sets alpha to calculated alpha for black