Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanNakagawa committed Oct 31, 2023
2 parents ee2b2fd + ce2c731 commit 8323f2c
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 38 deletions.
28 changes: 25 additions & 3 deletions _posts/2023-10-19-Gametest1.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ document.addEventListener("keyup",myCharacter.handleKeyup.bind(myCharacter));
// Make the E key related to boxObject1 disappear
showEKeySprite = false;
}
if (!checkForOverlap (myCharacterObject, boxstackObject2)) {
//Boxstackobject 1 dissapear
boxstackObject2.scale = [0, 0]
}
if (!checkForOverlap(myCharacterObject, boxstackObject2)) {
// Make the E key related to boxObject1 disappear
showEKeySprite = false;
}
if (!checkForOverlap (myCharacterObject, boxstackObject1)) {
//Boxstackobject 1 dissapear
boxstackObject1.scale = [0, 0]
}
if (!checkForOverlap(myCharacterObject, boxstackObject1)) {
// Make the E key related to boxObject1 disappear
showEKeySprite = false;
}
}
}
});
Expand Down Expand Up @@ -211,8 +227,14 @@ function frame(){ //when a frame is updated
console.log("Now press the E key");
showEKeySprite = true;
}


if (checkForOverlap(myCharacterObject, boxstackObject2)) {
console.log("Now press the E key");
showEKeySprite = true;
}
if (checkForOverlap(myCharacterObject, boxstackObject1)) {
console.log("Now press the E key");
showEKeySprite = true;
}

display.draw(1); //type 1 = with camera offset, type 2 = without camera offset

Expand Down Expand Up @@ -242,4 +264,4 @@ window.addEventListener('keydown', function(e) { //prevent space from moving scr
});

frame();
</script>
</script>
2 changes: 1 addition & 1 deletion _posts/2023-10-23-Main_menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ categories: ['C4.1']
function update() {
detect = 0;
// Clear Canvas for next frame
ctx.clearRect(0,0,canvas.width,canvas.height)
ctx.clearRect(0,0,canvas.width,canvas.height);
// Draw all images except for button
var offx = 10 * Math.random();
ctx.drawImage(sky,0,0,500,500);
Expand Down
1 change: 1 addition & 0 deletions _posts/2023-10-25-Game.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ categories: ['C4.1']
<canvas id="subDisplay1a" class="container2" height="500px" width="500px"></canvas>
<canvas id="subDisplay1b" class="container2" height="500px" width="500px"></canvas>
<canvas id="subDisplay1c" class="container2" height="500px" width="500px"></canvas>
<audio id="mainAudio" src="/Group/audio/MainRoomAmbience.mp3" preload="auto"></audio>

<script type="module">
//import needed modules
Expand Down
25 changes: 1 addition & 24 deletions _posts/2023-10-26-MiniGametest4.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ var characterYSpeed = 0; // Vertical speed of the character
var characterSpriteSheet = new Image();
characterSpriteSheet.src = "/Group/images/Game/walking-sprite.png";
var myCharacterObject = new Object("character", characterSpriteSheet,[44,54],[100,133],[0,500],5,1);
//main character death
var deathSpriteSheet = new Image();
deathSpriteSheet.src = "/Group/images/Game/deathsprite.png";
var deathObject = new Object("death", deathSpriteSheet, [24,54],[54,133],[0,1500],23,1);
var showdeathObject = false;

//potato monster
var monsterSpriteSheet = new Image();
Expand Down Expand Up @@ -91,7 +86,7 @@ var characterYSpeed = 0; // Vertical speed of the character

//text

var display = new subDisplay(canvas,[windowObject1,windowObject2,windowObject3,windowObject4,windowObject5,backgroundObject,elevatorObject,myCharacterObject,deathObject,monsterObject]);
var display = new subDisplay(canvas,[windowObject1,windowObject2,windowObject3,windowObject4,windowObject5,backgroundObject,elevatorObject,myCharacterObject,monsterObject]);

var fps = 22;
var active = true;
Expand Down Expand Up @@ -235,32 +230,14 @@ function frame(){ //when a frame is updated
}
if (checkForOverlap(myCharacterObject, monsterObject) || checkForOverlap(myCharacterObject, monsterObject)) {
console.log("test");
showdeathObject = true;
}

//console.log("fired")

display.draw(1); //type 1 = with camera offset, type 2 = without camera offset

// Draw the character or death sprite based on isCharacterAlive
if (isCharacterAlive) {
display.draw(1); // Draw the character if it's alive
} else {
// Draw the "deathsprite.png" in the character's position
var characterPosition = myCharacterObject.ReturnPosition();
deathObject.OverridePosition(characterPosition);
deathObject.UpdateFrame();
display.draw(1); // Draw the death sprite
}

canvas.getContext("2d").drawImage(hiddenCanvas,0,0); //draw shadows overtop

// Drawing the death sprite
if (showdeathObject) {
if (currentFrame % Math.round(fps/2)==0){
deathObject.UpdateFrame()
}
}
//run function again
setTimeout(function() {
if(active==true){
Expand Down
16 changes: 6 additions & 10 deletions _posts/2023-10-27-SimpilfiedEndCredits.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,17 @@ categories: ['C4.1']
ctx.fillText(text,xOffset,scrollY-yOffset); //draw text at middle, and draw y with scroll and offset
};
function addText() { //Text,Offset
text("Created By", 0);
text("Sean Nakagawa", 50);
var gradient = ctx.createLinearGradient(0,0,canvas.width,canvas.height); //create a gradient starting top left, ending bottom right
gradient.addColorStop(0.25,"blue"); //add colors
gradient.addColorStop(.5,"white");
gradient.addColorStop(.75,"blue");
text("Trystan Schmits", 100, {font:"700 24px cursive",fillStyle:gradient});
text("Zafeer Ahmed", 150);
text("Spencer Lyons", 200);
text("Created By", -400);
text("Sean Nakagawa", -450);
text("Trystan Schmits", -500);
text("Zafeer Ahmed", -550);
text("Spencer Lyons", -600);
};
var fps = 24;
function update() {
ctx.clearRect(0,0,canvas.width,canvas.height);
addText();
scrollY += 1;
scrollY -= 1;
setTimeout(requestAnimationFrame(update),1000/(fps));
};
startButton.addEventListener("click", function() {
Expand Down
Binary file added audio/MainRoomAmbience.mp3
Binary file not shown.
Binary file added images/Game/deathScreen/1Y.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Game/deathScreen/2O.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Game/deathScreen/3U.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Game/deathScreen/4D.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Game/deathScreen/5I.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Game/deathScreen/6E.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Game/deathScreen/7D.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions myScripts/GameScripts/DeathScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const canvas = document.getElelementById("deathScreen");
const ctx = canvas.getContext("2d");

// Create Letter Object
const letter = {
x: 0,
y: 0,
};

// Define Look Up List
const sources = ["/Group/images/Game/deathScreen/1Y.png","/Group/images/Game/deathScreen/2O.png","/Group/images/Game/deathScreen/3U.png","/Group/images/Game/deathScreen/4D.png","/Group/images/Game/deathScreen/5I.png","/Group/images/Game/deathScreen/6E.png","/Group/images/Game/deathScreen/7D.png"];

// Clone Letter
function slideY(y,newY) {
return (y-newY)/12;
};

y1 = new Image();
y1.src = sources[0];
o2 = new Image();
o2.src = sources[1];
u3 = new Image();
u3.src = sources[2];
d4 = new Image();
d4.src = sources[3];
i5 = new Image();
i5.src = sources[4];
e6 = new Image();
e6.src = sources[5];
d7 = new Image();
d7.src = sources[6];

function update() {
ctx.drawImage(o2,250,slideY(-250,250));
requestAnimationFrame(update);
};

update();

0 comments on commit 8323f2c

Please sign in to comment.