1
@@ -0,0 +1,388 @@
|
||||
class UIScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: 'UIScene' })
|
||||
}
|
||||
preload(){
|
||||
|
||||
}
|
||||
create(){
|
||||
gameState.UI = this;
|
||||
gameState.usageText = this.add.text(20, 5, `USAGE`, {
|
||||
fill: '#FFFFFF',
|
||||
fontSize: `20px`,
|
||||
fontFamily: 'LiberationSansNarrow',
|
||||
strokeThickness: 1,
|
||||
}).setInteractive().setDepth(3);
|
||||
gameState.powerText = this.add.text(20, 50, `POWER\n${Math.floor(gameState.power)}%`, {
|
||||
fill: '#FFFFFF',
|
||||
fontSize: `20px`,
|
||||
fontFamily: 'LiberationSansNarrow',
|
||||
strokeThickness: 1,
|
||||
}).setInteractive().setDepth(3);
|
||||
var usage1 = this.add.image(18,27,'usageBar').setOrigin(0,0);
|
||||
var usage2 = this.add.image(36,27,'usageBar').setOrigin(0,0);
|
||||
var usage3 = this.add.image(54,27,'usageBar').setOrigin(0,0);
|
||||
var usage4 = this.add.image(72,27,'usageBar').setOrigin(0,0);
|
||||
this.time.addEvent({
|
||||
delay: 1,
|
||||
callback: ()=>{
|
||||
if(gameState.usage >1){
|
||||
usage2.visible = true;
|
||||
}else{
|
||||
usage2.visible = false;
|
||||
}
|
||||
if(gameState.usage >2){
|
||||
usage3.visible = true;
|
||||
}else{
|
||||
usage3.visible = false;
|
||||
}
|
||||
if(gameState.usage >3){
|
||||
usage4.visible = true;
|
||||
}else{
|
||||
usage4.visible = false;
|
||||
}
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1,
|
||||
repeat:-1
|
||||
});
|
||||
gameState.hourText = this.add.text(1130, 10, `${gameState.hour} AM`, {
|
||||
fill: '#FFFFFF',
|
||||
fontSize: `20px`,
|
||||
fontFamily: 'LiberationSansNarrow',
|
||||
strokeThickness: 1,
|
||||
}).setInteractive().setDepth(3);
|
||||
}
|
||||
update(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Create ArenaScene Phaser SubClass
|
||||
class ArenaScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
//parameter for phaser class to allow phaser to reference subclass
|
||||
super({ key: 'ArenaScene' })
|
||||
}
|
||||
preload(){
|
||||
//no preloads for this subclass
|
||||
}
|
||||
create(){
|
||||
gameState.scene = this;
|
||||
gameState.input = this.input;
|
||||
gameState.mouse = this.input.mousePointer;
|
||||
gameState.cursors = this.input.keyboard.createCursorKeys();
|
||||
gameState.keys = this.input.keyboard.addKeys('W,S,A,D,R,SPACE,SHIFT,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,ESC,RIGHT,LEFT');
|
||||
|
||||
|
||||
gameState.ambience = this.sound.add('ambience');
|
||||
gameState.ambience.play(gameState.loopSound,true);
|
||||
|
||||
|
||||
gameState.officeDoorSound = this.sound.add('officeDoor');
|
||||
gameState.cameraFlipSound = this.sound.add('cameraFlip');
|
||||
|
||||
gameState.cameraStatic = gameState.scene.sound.add('videoStatic');
|
||||
|
||||
gameState.call = 0;
|
||||
|
||||
if(gameState.thingsToSave.night == 1){
|
||||
gameState.ennard.aiLevel = 0;
|
||||
gameState.ennard.position = 111;
|
||||
this.time.addEvent({
|
||||
delay: 5000,
|
||||
callback: ()=>{
|
||||
gameState.call = this.sound.add('nightOnePhoneCall');
|
||||
gameState.call.play();
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}else if(gameState.thingsToSave.night == 2){
|
||||
gameState.ennard.aiLevel = 5;
|
||||
this.time.addEvent({
|
||||
delay: 5000,
|
||||
callback: ()=>{
|
||||
gameState.call = this.sound.add('nightTwoPhoneCall');
|
||||
gameState.call.play();
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}else if(gameState.thingsToSave.night == 3){
|
||||
gameState.ennard.aiLevel = 10;
|
||||
this.time.addEvent({
|
||||
delay: 5000,
|
||||
callback: ()=>{
|
||||
gameState.call = this.sound.add('nightThreePhoneCall');
|
||||
gameState.call.play();
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}else if(gameState.thingsToSave.night == 4){
|
||||
gameState.ennard.aiLevel = 14;
|
||||
this.time.addEvent({
|
||||
delay: 5000,
|
||||
callback: ()=>{
|
||||
gameState.call = this.sound.add('nightFourPhoneCall');
|
||||
gameState.call.play();
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}else if(gameState.thingsToSave.night == 5){
|
||||
gameState.ennard.aiLevel = 20;
|
||||
this.time.addEvent({
|
||||
delay: 5000,
|
||||
callback: ()=>{
|
||||
gameState.call = this.sound.add('nightFivePhoneCall');
|
||||
gameState.call.play();
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}
|
||||
else if(gameState.thingsToSave.night == 6){
|
||||
gameState.ennard.aiLevel = 0;
|
||||
this.time.addEvent({
|
||||
delay: 5000,
|
||||
callback: ()=>{
|
||||
gameState.call = this.sound.add('nightSixPhoneCall');
|
||||
gameState.call.play();
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}
|
||||
|
||||
var timeChecker = this.time.addEvent({
|
||||
delay: 60000,
|
||||
callback: ()=>{
|
||||
if(gameState.hour == 12){
|
||||
gameState.hour = 1;
|
||||
if(gameState.power > 0){
|
||||
gameState.hourText.setText(`${gameState.hour} AM`);
|
||||
}
|
||||
}else{
|
||||
gameState.hour++;
|
||||
if(gameState.power > 0){
|
||||
gameState.hourText.setText(`${gameState.hour} AM`);
|
||||
}
|
||||
}
|
||||
if(gameState.hour == 6){
|
||||
if(gameState.thingsToSave.night <6){
|
||||
gameState.thingsToSave.night++;
|
||||
}
|
||||
gameState.save();
|
||||
gameState.ambience.stop();
|
||||
gameState.call.stop();
|
||||
gameState.scene.scene.stop('ArenaScene');
|
||||
gameState.scene.scene.stop('CameraScene');
|
||||
gameState.scene.scene.start('MenuScene');
|
||||
}
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1,
|
||||
repeat: 5
|
||||
});
|
||||
|
||||
this.add.image(0,0,'blackBackground').setOrigin(0,0).setScale(10).setDepth(0);
|
||||
gameState.scrapBabySprite = this.add.sprite(0,0,'officeScrapBaby').setOrigin(0,0);
|
||||
gameState.scrapBabySprite.setFrame(0);
|
||||
var officeBg = this.add.sprite(0,0,'officeBackground').setOrigin(0,0).setDepth(3);
|
||||
officeBg.anims.play('officeBackgroundAction','true');
|
||||
|
||||
|
||||
gameState.rightDoor = this.add.sprite(0,0,'rightDoor').setOrigin(0,0).setDepth(3);
|
||||
gameState.rightDoor.setFrame(9);
|
||||
gameState.leftDoor = this.add.sprite(0,0,'leftDoor').setOrigin(0,0).setDepth(3);
|
||||
gameState.leftDoor.setFrame(9);
|
||||
gameState.ventDoor = this.add.sprite(0,0,'ventDoor').setOrigin(0,0).setDepth(3);
|
||||
gameState.ventDoor.setFrame(9);
|
||||
gameState.cameraMoniter = this.add.sprite(0,0,'cameraMoniter').setOrigin(0,0).setDepth(3);
|
||||
gameState.cameraMoniter.setFrame(15);
|
||||
gameState.inputTimer = 60;
|
||||
|
||||
this.scene.launch('CameraScene');
|
||||
this.scene.pause('CameraScene');
|
||||
this.scene.bringToTop('ArenaScene');
|
||||
|
||||
this.scene.launch('UIScene');
|
||||
this.scene.bringToTop('UIScene');
|
||||
|
||||
|
||||
var powerChecker = this.time.addEvent({
|
||||
delay: 1,
|
||||
callback: ()=>{
|
||||
gameState.power -= 0.0023*gameState.usage;
|
||||
gameState.powerText.setText(`POWER\n${Math.floor(gameState.power)}%`);
|
||||
if(gameState.power <= 0){
|
||||
var powerDown = this.sound.add('powerDownSound');
|
||||
powerDown.play();
|
||||
gameState.call.stop();
|
||||
gameState.ambience.stop();
|
||||
powerChecker.destroy();
|
||||
cameraButton.destroy();
|
||||
gameState.powerText.destroy();
|
||||
this.scene.stop('UIScene');
|
||||
gameState.locked = true;
|
||||
if(gameState.rightDoorStatus == true){
|
||||
gameState.rightDoor.anims.play('rightDoorOpen','true');
|
||||
gameState.rightDoorStatus = true;
|
||||
}if(gameState.leftDoorStatus == true){
|
||||
gameState.leftDoor.anims.play('leftDoorOpen','true');
|
||||
gameState.leftDoorStatus = false;
|
||||
}if (gameState.ventDoorStatus == true){
|
||||
gameState.ventDoor.anims.play('ventDoorOpen','true');
|
||||
gameState.ventDoorStatus = false;
|
||||
}if (gameState.cameraMoniterStatus == true){
|
||||
gameState.cameraMoniter.anims.play('cameraMoniterClose','true');
|
||||
gameState.scene.scene.pause('CameraScene');
|
||||
gameState.scene.scene.bringToTop('ArenaScene');
|
||||
gameState.cameraMoniterStatus = false;
|
||||
}
|
||||
officeBg.anims.stop();
|
||||
officeBg.setFrame(5);
|
||||
}
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1,
|
||||
repeat:-1
|
||||
});
|
||||
|
||||
var cameraButton = this.add.sprite(400,650,'cameraButton').setOrigin(0,0).setDepth(3).setInteractive();
|
||||
cameraButton.on('pointerover', function(pointer){
|
||||
if(gameState.inputTimer>30 && gameState.locked == false){
|
||||
gameState.cameraFlipSound.play();
|
||||
gameState.inputTimer = 0;
|
||||
if(gameState.cameraMoniterStatus == false){
|
||||
gameState.cameraMoniter.anims.play('cameraMoniterOpen','true');
|
||||
gameState.scene.time.addEvent({
|
||||
delay: 300,
|
||||
callback: ()=>{
|
||||
gameState.cameraStatic.play(gameState.lowLoopSound);
|
||||
gameState.cameraMoniterStatus = true;
|
||||
gameState.usage += 1;
|
||||
gameState.scene.scene.resume('CameraScene');
|
||||
gameState.scene.scene.bringToTop('CameraScene');
|
||||
gameState.scene.scene.bringToTop('UIScene');
|
||||
gameState.update(gameState.cameraScene);
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if(gameState.thingsToSave.night != 6){
|
||||
gameState.ennard.movement(this);
|
||||
}else{
|
||||
gameState.scrapBaby.movement(this);
|
||||
gameState.ennard.position = 111;
|
||||
}
|
||||
|
||||
}
|
||||
update(){
|
||||
gameState.inputTimer++;
|
||||
if(gameState.inputTimer>30 && gameState.locked == false){
|
||||
if(gameState.keys.A.isDown && gameState.cameraMoniterStatus == false){
|
||||
gameState.officeDoorSound.play();
|
||||
gameState.inputTimer = 0;
|
||||
if(gameState.leftDoorStatus == false){
|
||||
gameState.leftDoor.anims.play('leftDoorClose','true');
|
||||
gameState.leftDoorStatus = true;
|
||||
gameState.usage += 1;
|
||||
}else{
|
||||
gameState.leftDoor.anims.play('leftDoorOpen','true');
|
||||
gameState.leftDoorStatus = false;
|
||||
gameState.usage -= 1;
|
||||
}
|
||||
}
|
||||
else if(gameState.keys.D.isDown && gameState.cameraMoniterStatus == false){
|
||||
gameState.officeDoorSound.play();
|
||||
gameState.inputTimer = 0;
|
||||
if(gameState.rightDoorStatus == false){
|
||||
gameState.rightDoor.anims.play('rightDoorClose','true');
|
||||
gameState.rightDoorStatus = true;
|
||||
gameState.usage += 1;
|
||||
}else{
|
||||
gameState.rightDoor.anims.play('rightDoorOpen','true');
|
||||
gameState.rightDoorStatus = false;
|
||||
gameState.usage -= 1;
|
||||
}
|
||||
}
|
||||
else if(gameState.keys.W.isDown && gameState.cameraMoniterStatus == false){
|
||||
gameState.officeDoorSound.play();
|
||||
gameState.inputTimer = 0;
|
||||
if(gameState.ventDoorStatus == false){
|
||||
gameState.ventDoor.anims.play('ventDoorClose','true');
|
||||
gameState.ventDoorStatus = true;
|
||||
gameState.usage += 1;
|
||||
}else{
|
||||
gameState.ventDoor.anims.play('ventDoorOpen','true');
|
||||
gameState.ventDoorStatus = false;
|
||||
gameState.usage -= 1;
|
||||
}
|
||||
}
|
||||
else if(gameState.keys.S.isDown){
|
||||
gameState.cameraFlipSound.play();
|
||||
gameState.inputTimer = 0;
|
||||
if(gameState.cameraMoniterStatus == false){
|
||||
gameState.cameraMoniter.anims.play('cameraMoniterOpen','true');
|
||||
this.time.addEvent({
|
||||
delay: 300,
|
||||
callback: ()=>{
|
||||
gameState.cameraStatic.play(gameState.lowLoopSound);
|
||||
gameState.cameraMoniterStatus = true;
|
||||
gameState.usage += 1;
|
||||
gameState.scene.scene.resume('CameraScene');
|
||||
gameState.scene.scene.bringToTop('CameraScene');
|
||||
gameState.scene.scene.bringToTop('UIScene');
|
||||
gameState.update(gameState.cameraScene);
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}else{
|
||||
gameState.cameraStatic.stop();
|
||||
gameState.cameraMoniter.anims.play('cameraMoniterClose','true');
|
||||
gameState.scene.scene.pause('CameraScene');
|
||||
gameState.scene.scene.bringToTop('ArenaScene');
|
||||
gameState.scene.scene.bringToTop('UIScene');
|
||||
gameState.cameraMoniterStatus = false;
|
||||
gameState.usage -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
class CameraScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: 'CameraScene' })
|
||||
}
|
||||
preload(){
|
||||
|
||||
}
|
||||
create(){
|
||||
gameState.cameraScene = this;
|
||||
gameState.cameraScreen = this.add.sprite(0,0,'blackBackground').setOrigin(0,0);
|
||||
gameState.static = this.add.sprite(0,0,'cameraStatic').setOrigin(0,0);
|
||||
gameState.static.anims.play('cameraStaticAction','true');
|
||||
this.add.image(0,0,'cameraBackground').setOrigin(0,0);
|
||||
var cam01 = this.add.sprite(750,580,'CAM01Button').setOrigin(0,0).setInteractive();
|
||||
cam01.on('pointerdown', function(pointer){
|
||||
gameState.camPosition = 1;
|
||||
gameState.update(gameState.cameraScene);
|
||||
});
|
||||
var cam02 = this.add.sprite(1020,580,'CAM02Button').setOrigin(0,0).setInteractive();
|
||||
cam02.on('pointerdown', function(pointer){
|
||||
gameState.camPosition = 2;
|
||||
gameState.update(gameState.cameraScene);
|
||||
});
|
||||
var cam03 = this.add.sprite(680,500,'CAM03Button').setOrigin(0,0).setInteractive();
|
||||
cam03.on('pointerdown', function(pointer){
|
||||
gameState.camPosition = 3;
|
||||
gameState.update(gameState.cameraScene);
|
||||
});
|
||||
var cam04 = this.add.sprite(1100,500,'CAM04Button').setOrigin(0,0).setInteractive();
|
||||
cam04.on('pointerdown', function(pointer){
|
||||
gameState.camPosition = 4;
|
||||
gameState.update(gameState.cameraScene);
|
||||
});
|
||||
var cam05 = this.add.sprite(880,440,'CAM05Button').setOrigin(0,0).setInteractive();
|
||||
cam05.on('pointerdown', function(pointer){
|
||||
gameState.camPosition = 5;
|
||||
gameState.update(gameState.cameraScene);
|
||||
});
|
||||
var cam06 = this.add.sprite(750,290,'CAM06Button').setOrigin(0,0).setInteractive();
|
||||
cam06.on('pointerdown', function(pointer){
|
||||
gameState.camPosition = 6;
|
||||
gameState.update(gameState.cameraScene);
|
||||
});
|
||||
var cam07 = this.add.sprite(1020,290,'CAM07Button').setOrigin(0,0).setInteractive();
|
||||
cam07.on('pointerdown', function(pointer){
|
||||
gameState.camPosition = 7;
|
||||
gameState.update(gameState.cameraScene);
|
||||
});
|
||||
|
||||
var cameraButton = this.add.sprite(400,650,'cameraButton').setOrigin(0,0).setDepth(3).setInteractive();
|
||||
cameraButton.on('pointerover', function(pointer){
|
||||
if(gameState.inputTimer>30 && gameState.locked == false){
|
||||
gameState.cameraFlipSound.play();
|
||||
gameState.inputTimer = 0;
|
||||
if(gameState.cameraMoniterStatus == true){
|
||||
gameState.cameraStatic.stop();
|
||||
gameState.cameraMoniter.anims.play('cameraMoniterClose','true');
|
||||
gameState.scene.scene.pause('CameraScene');
|
||||
gameState.scene.scene.bringToTop('ArenaScene');
|
||||
gameState.scene.scene.bringToTop('UIScene');
|
||||
gameState.cameraMoniterStatus = false;
|
||||
gameState.usage -= 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
update(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,493 @@
|
||||
//The configuration of your game that is a parameter of the Phaser.Game function
|
||||
const config = {
|
||||
type: Phaser.AUTO,
|
||||
width : 1200,
|
||||
height: 700,
|
||||
backgroundColor: "#000000",
|
||||
audio: {
|
||||
disableWebAudio: false
|
||||
},
|
||||
//allows modification of the games physics
|
||||
physics: {
|
||||
default: 'arcade',
|
||||
arcade: {
|
||||
gravity: { y: 0 },
|
||||
enableBody: true
|
||||
//debug: true
|
||||
}
|
||||
},
|
||||
//subclass scenes
|
||||
scene:[MenuScene,ArenaScene,CameraScene,UIScene],
|
||||
//phasers scale system to fit into the brower
|
||||
scale: {
|
||||
zoom: 1,
|
||||
mode: Phaser.Scale.FIT,
|
||||
autoCenter: Phaser.Scale.CENTER_BOTH
|
||||
}
|
||||
};
|
||||
|
||||
//creats a game game object with the configuration
|
||||
const game = new Phaser.Game(config);
|
||||
|
||||
//create a block-scoped object that stores variables that can be accessed in any scene
|
||||
let gameState = {
|
||||
thingsToSave:{
|
||||
night: 1
|
||||
},
|
||||
save: function(){
|
||||
window.localStorage.setItem("thingsToSave", JSON.stringify(gameState.thingsToSave));
|
||||
},
|
||||
loadSave: function(){
|
||||
if(JSON.parse(window.localStorage.getItem("thingsToSave")) !== null){
|
||||
gameState.thingsToSave = JSON.parse(window.localStorage.getItem("thingsToSave"));
|
||||
}
|
||||
},
|
||||
locked: false,
|
||||
leftDoorStatus: false,
|
||||
rightDoorStatus: false,
|
||||
ventDoorStatus: false,
|
||||
cameraMoniterStatus: false,
|
||||
camPosition: 1,
|
||||
power: 100,
|
||||
usage: 1,
|
||||
hour: 12,
|
||||
reset :function(){
|
||||
gameState.locked = false;
|
||||
gameState.leftDoorStatus = false;
|
||||
gameState.rightDoorStatus = false;
|
||||
gameState.ventDoorStatus = false;
|
||||
gameState.cameraMoniterStatus = false;
|
||||
gameState.camPosition = 1;
|
||||
gameState.usage = 1;
|
||||
gameState.power = 100;
|
||||
gameState.ennard.position = 7;
|
||||
gameState.ennard.cooldown = 5000;
|
||||
gameState.scrapBaby.position = 7;
|
||||
gameState.scrapBaby.cooldown = 5000;
|
||||
gameState.hour = 12;
|
||||
},
|
||||
update: function(scene){
|
||||
gameState.static.alpha = 1;
|
||||
scene.tweens.add({
|
||||
targets: gameState.static,
|
||||
alpha: 0.1,
|
||||
duration: 500,
|
||||
ease: 'Power2'
|
||||
}, scene);
|
||||
if(gameState.camPosition == 1){
|
||||
if(gameState.ennard.position == 1){
|
||||
gameState.cameraScreen.setTexture('CAM01ennard');
|
||||
}else if(gameState.ennard.position == 12){
|
||||
gameState.cameraScreen.setTexture('CAM01ennard2');
|
||||
}else if(gameState.scrapBaby.position == 1){
|
||||
gameState.cameraScreen.setTexture('CAM01scrapBaby');
|
||||
}else if(gameState.scrapBaby.position == 12){
|
||||
gameState.cameraScreen.setTexture('CAM01scrapBaby2');
|
||||
}else{
|
||||
gameState.cameraScreen.setTexture('CAM01');
|
||||
}
|
||||
}else if(gameState.camPosition == 2){
|
||||
if(gameState.ennard.position == 2){
|
||||
gameState.cameraScreen.setTexture('CAM02ennard');
|
||||
}else if(gameState.ennard.position == 22){
|
||||
gameState.cameraScreen.setTexture('CAM02ennard2');
|
||||
}else{
|
||||
gameState.cameraScreen.setTexture('CAM02');
|
||||
}
|
||||
}else if(gameState.camPosition == 3){
|
||||
if(gameState.ennard.position == 3){
|
||||
gameState.cameraScreen.setTexture('CAM03ennard');
|
||||
}else{
|
||||
gameState.cameraScreen.setTexture('CAM03');
|
||||
}
|
||||
}else if(gameState.camPosition == 4){
|
||||
if(gameState.ennard.position == 4){
|
||||
gameState.cameraScreen.setTexture('CAM04ennard');
|
||||
}else{
|
||||
gameState.cameraScreen.setTexture('CAM04');
|
||||
}
|
||||
}else if(gameState.camPosition == 5){
|
||||
if(gameState.ennard.position == 5){
|
||||
gameState.cameraScreen.setTexture('CAM05ennard');
|
||||
}else if(gameState.ennard.position == 52){
|
||||
gameState.cameraScreen.setTexture('CAM05ennard2');
|
||||
}else{
|
||||
gameState.cameraScreen.setTexture('CAM05');
|
||||
}
|
||||
}else if(gameState.camPosition == 6){
|
||||
gameState.cameraScreen.setTexture('CAM06');
|
||||
}else if(gameState.camPosition == 7){
|
||||
if(gameState.ennard.position == 7){
|
||||
gameState.cameraScreen.setTexture('CAM07ennard');
|
||||
}else{
|
||||
gameState.cameraScreen.setTexture('CAM07');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
ennard:{
|
||||
position: 7,
|
||||
cooldown: 5000,
|
||||
aiLevel: 3,
|
||||
moveFunction: null,
|
||||
movement: function(scene){
|
||||
gameState.ennard.moveFunction = scene.time.addEvent({
|
||||
delay: gameState.ennard.cooldown,
|
||||
callback: ()=>{
|
||||
var random = Math.ceil(Math.random()*20);
|
||||
if(gameState.ennard.aiLevel >= random || gameState.ennard.position == 0 || gameState.power <= 0){
|
||||
if(gameState.ennard.position == 111 && gameState.power <= 0){
|
||||
gameState.ennard.position = 12;
|
||||
}
|
||||
if(gameState.ennard.position == 7){
|
||||
var rand = Math.ceil(Math.random()*3);
|
||||
if(rand == 1){
|
||||
gameState.ennard.position = 4;
|
||||
}else if(rand == 2){
|
||||
gameState.ennard.position = 6;
|
||||
}else{
|
||||
gameState.ennard.position = 5;
|
||||
}
|
||||
}else if (gameState.ennard.position == 6){
|
||||
var rand = Math.ceil(Math.random()*4);
|
||||
if(rand == 1){
|
||||
gameState.ennard.position = 3;
|
||||
}else if(rand == 2){
|
||||
gameState.ennard.position = 1;
|
||||
}else if(rand == 3){
|
||||
gameState.ennard.position = 4;
|
||||
}else{
|
||||
gameState.ennard.position = 5;
|
||||
}
|
||||
}else if (gameState.ennard.position == 5){
|
||||
gameState.ennard.position = 52;
|
||||
}else if (gameState.ennard.position == 52){
|
||||
if(gameState.ventDoorStatus == false){
|
||||
scene.time.addEvent({
|
||||
delay: 400,
|
||||
callback: ()=>{
|
||||
gameState.locked = true;
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
gameState.ennard.position = 0;
|
||||
gameState.ennard.cooldown = 800;
|
||||
}else{
|
||||
gameState.ennard.position = 6;
|
||||
}
|
||||
}
|
||||
|
||||
else if (gameState.ennard.position == 4){
|
||||
gameState.ennard.position = 2;
|
||||
}
|
||||
else if (gameState.ennard.position==2){
|
||||
gameState.ennard.position = 22;
|
||||
}else if (gameState.ennard.position==22){
|
||||
if(gameState.rightDoorStatus == false){
|
||||
scene.time.addEvent({
|
||||
delay: 400,
|
||||
callback: ()=>{
|
||||
gameState.locked = true;
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
gameState.ennard.position = 0;
|
||||
gameState.ennard.cooldown = 800;
|
||||
}else{
|
||||
gameState.ennard.position = 7;
|
||||
}
|
||||
}
|
||||
|
||||
else if (gameState.ennard.position==3){
|
||||
gameState.ennard.position = 1;
|
||||
}
|
||||
|
||||
else if (gameState.ennard.position==1){
|
||||
gameState.ennard.position = 12;
|
||||
}else if (gameState.ennard.position==12){
|
||||
if(gameState.leftDoorStatus == false){
|
||||
gameState.ennard.position = 0;
|
||||
gameState.ennard.cooldown = 800;
|
||||
scene.time.addEvent({
|
||||
delay: 400,
|
||||
callback: ()=>{
|
||||
gameState.locked = true;
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}else{
|
||||
var rand = Math.ceil(Math.random()*2);
|
||||
if(rand == 1){
|
||||
gameState.ennard.position = 6;
|
||||
}else{
|
||||
gameState.ennard.position = 7;
|
||||
}
|
||||
}
|
||||
}else if (gameState.ennard.position==0){
|
||||
gameState.ennard.cooldown = 10000;
|
||||
gameState.call.stop();
|
||||
gameState.ambience.stop();
|
||||
gameState.ennard.jumpscare(gameState.scene);
|
||||
}
|
||||
gameState.update(gameState.cameraScene);
|
||||
}
|
||||
|
||||
gameState.ennard.movement(scene);
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
},
|
||||
jumpscare:function(scene){
|
||||
gameState.locked = true;
|
||||
if(gameState.cameraMoniterStatus == true){
|
||||
gameState.cameraMoniter.anims.play('cameraMoniterClose','true');
|
||||
gameState.scene.scene.pause('CameraScene');
|
||||
gameState.scene.scene.bringToTop('ArenaScene');
|
||||
gameState.cameraMoniterStatus = false;
|
||||
}
|
||||
var ennard = scene.add.sprite(0,0,'ennardJs').setOrigin(0,0).setDepth(4);
|
||||
ennard.anims.play('ennardJsAction','true');
|
||||
var ennardJs = scene.sound.add('ennardJsSound');
|
||||
ennardJs.play();
|
||||
scene.time.addEvent({
|
||||
delay: 900,
|
||||
callback: ()=>{
|
||||
scene.scene.stop('CameraScene');
|
||||
scene.scene.stop('ArenaScene');
|
||||
scene.scene.start('MenuScene');
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
scrapBaby:{
|
||||
position: 7,
|
||||
cooldown: 5000,
|
||||
aiLevel: 20,
|
||||
moveFunction: null,
|
||||
movement: function(scene){
|
||||
gameState.scrapBaby.moveFunction = scene.time.addEvent({
|
||||
delay: gameState.scrapBaby.cooldown,
|
||||
callback: ()=>{
|
||||
var random = Math.ceil(Math.random()*20);
|
||||
if(gameState.scrapBaby.aiLevel >= random || gameState.scrapBaby.position == 0 || gameState.power <= 0){
|
||||
if(gameState.scrapBaby.position == 111 && gameState.power <= 0){
|
||||
gameState.scrapBaby.position = 12;
|
||||
}
|
||||
if(gameState.scrapBaby.position == 7){
|
||||
var rand = Math.ceil(Math.random()*3);
|
||||
if(rand == 1){
|
||||
gameState.scrapBaby.position = 4;
|
||||
}else if(rand == 2){
|
||||
gameState.scrapBaby.position = 6;
|
||||
}else{
|
||||
gameState.scrapBaby.position = 5;
|
||||
}
|
||||
}else if (gameState.scrapBaby.position == 6){
|
||||
var rand = Math.ceil(Math.random()*4);
|
||||
if(rand == 1){
|
||||
gameState.scrapBaby.position = 3;
|
||||
}else if(rand == 2){
|
||||
gameState.scrapBaby.position = 1;
|
||||
}else if(rand == 3){
|
||||
gameState.scrapBaby.position = 4;
|
||||
}else{
|
||||
gameState.scrapBaby.position = 5;
|
||||
}
|
||||
}else if (gameState.scrapBaby.position == 5){
|
||||
gameState.scrapBaby.position = 52;
|
||||
}else if (gameState.scrapBaby.position == 52){
|
||||
if(gameState.ventDoorStatus == false){
|
||||
scene.time.addEvent({
|
||||
delay: 400,
|
||||
callback: ()=>{
|
||||
gameState.locked = true;
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
gameState.scrapBaby.position = 0;
|
||||
gameState.scrapBaby.cooldown = 800;
|
||||
}else{
|
||||
gameState.scrapBaby.position = 7;
|
||||
}
|
||||
}
|
||||
|
||||
else if (gameState.scrapBaby.position == 4){
|
||||
gameState.scrapBaby.position = 2;
|
||||
}
|
||||
else if (gameState.scrapBaby.position==2){
|
||||
gameState.scrapBaby.position = 22;
|
||||
}else if (gameState.scrapBaby.position==22){
|
||||
if(gameState.rightDoorStatus == false){
|
||||
scene.time.addEvent({
|
||||
delay: 400,
|
||||
callback: ()=>{
|
||||
gameState.locked = true;
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
gameState.scrapBaby.position = 0;
|
||||
gameState.scrapBaby.cooldown = 800;
|
||||
}else{
|
||||
var rand = Math.ceil(Math.random()*2);
|
||||
if(rand == 1){
|
||||
gameState.scrapBaby.position = 23;
|
||||
gameState.scrapBabySprite.setFrame(2);
|
||||
gameState.scrapBabySprite.alpha = 0;
|
||||
scene.tweens.add({
|
||||
targets: gameState.scrapBabySprite,
|
||||
alpha: 1,
|
||||
duration: 1000,
|
||||
ease: 'Power2'
|
||||
}, scene);
|
||||
|
||||
}else{
|
||||
gameState.scrapBaby.position = 6;
|
||||
}
|
||||
}
|
||||
}else if (gameState.scrapBaby.position==23){
|
||||
if(gameState.rightDoorStatus == false){
|
||||
gameState.scrapBabySprite.alpha = 1;
|
||||
scene.tweens.add({
|
||||
targets: gameState.scrapBabySprite,
|
||||
alpha: 0,
|
||||
duration: 500,
|
||||
ease: 'Power2'
|
||||
}, scene);
|
||||
scene.time.addEvent({
|
||||
delay: 400,
|
||||
callback: ()=>{
|
||||
gameState.locked = true;
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
gameState.scrapBaby.position = 0;
|
||||
gameState.scrapBaby.cooldown = 800;
|
||||
}else{
|
||||
gameState.scrapBabySprite.setFrame(0);
|
||||
gameState.scrapBaby.position = 6;
|
||||
}
|
||||
}
|
||||
|
||||
else if (gameState.scrapBaby.position==3){
|
||||
gameState.scrapBaby.position = 1;
|
||||
}
|
||||
|
||||
else if (gameState.scrapBaby.position==1){
|
||||
gameState.scrapBaby.position = 12;
|
||||
}else if (gameState.scrapBaby.position==12){
|
||||
if(gameState.leftDoorStatus == false){
|
||||
gameState.scrapBaby.position = 0;
|
||||
gameState.scrapBaby.cooldown = 800;
|
||||
scene.time.addEvent({
|
||||
delay: 400,
|
||||
callback: ()=>{
|
||||
gameState.locked = true;
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}else{
|
||||
var rand = Math.ceil(Math.random()*2);
|
||||
if(rand == 1){
|
||||
gameState.scrapBaby.position = 13;
|
||||
gameState.scrapBabySprite.setFrame(1);
|
||||
gameState.scrapBabySprite.alpha = 0;
|
||||
scene.tweens.add({
|
||||
targets: gameState.scrapBabySprite,
|
||||
alpha: 1,
|
||||
duration: 1000,
|
||||
ease: 'Power2'
|
||||
}, scene);
|
||||
|
||||
}else{
|
||||
gameState.scrapBaby.position = 6;
|
||||
}
|
||||
}
|
||||
}else if (gameState.scrapBaby.position==13){
|
||||
if(gameState.leftDoorStatus == false){
|
||||
gameState.scrapBabySprite.alpha = 1;
|
||||
scene.tweens.add({
|
||||
targets: gameState.scrapBabySprite,
|
||||
alpha: 0,
|
||||
duration: 600,
|
||||
ease: 'Power2'
|
||||
}, scene);
|
||||
gameState.scrapBaby.position = 0;
|
||||
gameState.scrapBaby.cooldown = 800;
|
||||
scene.time.addEvent({
|
||||
delay: 400,
|
||||
callback: ()=>{
|
||||
gameState.locked = true;
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}else{
|
||||
gameState.scrapBabySprite.setFrame(0);
|
||||
var rand = Math.ceil(Math.random()*2);
|
||||
if(rand == 1){
|
||||
gameState.scrapBaby.position = 6;
|
||||
}else{
|
||||
gameState.scrapBaby.position = 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (gameState.scrapBaby.position==0){
|
||||
gameState.scrapBaby.cooldown = 10000;
|
||||
gameState.call.stop();
|
||||
gameState.ambience.stop();
|
||||
gameState.scrapBaby.jumpscare(gameState.scene);
|
||||
}
|
||||
gameState.update(gameState.cameraScene);
|
||||
}
|
||||
console.log(gameState.scrapBaby.position);
|
||||
gameState.scrapBaby.movement(scene);
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
},
|
||||
jumpscare:function(scene){
|
||||
gameState.locked = true;
|
||||
if(gameState.cameraMoniterStatus == true){
|
||||
gameState.cameraMoniter.anims.play('cameraMoniterClose','true');
|
||||
gameState.scene.scene.pause('CameraScene');
|
||||
gameState.scene.scene.bringToTop('ArenaScene');
|
||||
gameState.cameraMoniterStatus = false;
|
||||
}
|
||||
var scrapBaby = scene.add.sprite(0,0,'scrapBabyJumpscare').setOrigin(0,0).setDepth(4);
|
||||
scrapBaby.anims.play('scrapBabyJumpscareAction','true');
|
||||
var scrapBabyJs = scene.sound.add('scrapBabyJumpscare');
|
||||
scrapBabyJs.play();
|
||||
scene.time.addEvent({
|
||||
delay: 900,
|
||||
callback: ()=>{
|
||||
scene.scene.stop('CameraScene');
|
||||
scene.scene.stop('ArenaScene');
|
||||
scene.scene.start('MenuScene');
|
||||
},
|
||||
startAt: 0,
|
||||
timeScale: 1
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
fireRate: 10,
|
||||
rateCooldown: 0,
|
||||
gameSpeed: 100
|
||||
}
|
||||
|
After Width: | Height: | Size: 864 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 929 KiB |
|
After Width: | Height: | Size: 929 KiB |
|
After Width: | Height: | Size: 940 KiB |
|
After Width: | Height: | Size: 935 KiB |
|
After Width: | Height: | Size: 439 KiB |
|
After Width: | Height: | Size: 879 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 941 KiB |
|
After Width: | Height: | Size: 944 KiB |
|
After Width: | Height: | Size: 663 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 718 KiB |
|
After Width: | Height: | Size: 770 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 365 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 415 KiB |
|
After Width: | Height: | Size: 621 KiB |
|
After Width: | Height: | Size: 733 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 601 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 600 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 3.3 MiB |
|
After Width: | Height: | Size: 381 KiB |
|
After Width: | Height: | Size: 423 KiB |
|
After Width: | Height: | Size: 572 KiB |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 297 KiB |
|
After Width: | Height: | Size: 402 KiB |
|
After Width: | Height: | Size: 7.0 MiB |
|
After Width: | Height: | Size: 156 B |
|
After Width: | Height: | Size: 231 KiB |
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="phaser.min.js"></script>
|
||||
<script src="phaser.js"></script>
|
||||
<script src="menu.js"></script>
|
||||
<script src="ArenaScene.js"></script>
|
||||
<script src="Camera.js"></script>
|
||||
<script src="game.js"></script>
|
||||
<title>FNASL</title>
|
||||
<link rel="icon" href="https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/2bee4c22-7320-4809-a9fa-21b4872ff1f9/dc10frk-13ae6b43-f3df-4338-8c1d-8d4e86e7a8eb.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcLzJiZWU0YzIyLTczMjAtNDgwOS1hOWZhLTIxYjQ4NzJmZjFmOVwvZGMxMGZyay0xM2FlNmI0My1mM2RmLTQzMzgtOGMxZC04ZDRlODZlN2E4ZWIucG5nIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.Dm1PjqSAPEhHfLspYuYuPVcE4xYm5m0Ex7YaA9Tisbw">
|
||||
</head>
|
||||
<body>
|
||||
<style media='screen' type='text/css'>
|
||||
@font-face {
|
||||
font-family: LiberationSansNarrow;
|
||||
src: url('/LiberationSansNarrow-Regular.ttf');
|
||||
font-weight:400;
|
||||
font-weight:normal;
|
||||
}
|
||||
</style>
|
||||
<div style="font-family:LiberationSansNarrow; position:absolute; left:-1000px; visibility:hidden;">.</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,282 @@
|
||||
//menu subclass
|
||||
class MenuScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
//parameter for phaser class to allow phaser to reference subclass
|
||||
super({ key: 'MenuScene' })
|
||||
}
|
||||
//functions preloads sprites, images, and audio
|
||||
preload(){
|
||||
this.load.spritesheet('mainMenuStatic','images/mainMenuStatic.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.spritesheet('officeBackground','images/officeBackground.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.spritesheet('rightDoor','images/rightDoor.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.spritesheet('leftDoor','images/leftDoor.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.spritesheet('ventDoor','images/ventDoor.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.spritesheet('cameraMoniter','images/cameraMoniter.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.spritesheet('cameraStatic','images/cameraStatic.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.spritesheet('officeScrapBaby','images/officeScrapBaby.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.spritesheet('scrapBabyJumpscare','images/scrapBabyJumpscare.png',{frameWidth: 1200,frameHeight:700});
|
||||
this.load.image('mainMenuBackground','images/mainMenuBackground.png');
|
||||
this.load.image('menuTextLine','images/menuTextLine.png');
|
||||
this.load.image('cameraBackground','images/cameraBackground.png');
|
||||
this.load.image('blackBackground','images/blackBackground.png');
|
||||
this.load.image('CAM01','images/CAM01.png');
|
||||
this.load.image('CAM01ennard','images/CAM01ennard.png');
|
||||
this.load.image('CAM01ennard2','images/CAM01ennard2.png');
|
||||
this.load.image('CAM01scrapBaby','images/CAM01scrapBaby.png');
|
||||
this.load.image('CAM01scrapBaby2','images/CAM01scrapBaby2.png');
|
||||
this.load.image('CAM02','images/CAM02.png');
|
||||
this.load.image('CAM02ennard','images/CAM02ennard.png');
|
||||
this.load.image('CAM02ennard2','images/CAM02ennard2.png');
|
||||
this.load.image('CAM03','images/CAM03.png');
|
||||
this.load.image('CAM03ennard','images/CAM03ennard.png');
|
||||
this.load.image('CAM04','images/CAM04.png');
|
||||
this.load.image('CAM04ennard','images/CAM04ennard.png');
|
||||
this.load.image('CAM05','images/CAM05.png');
|
||||
this.load.image('CAM05ennard','images/CAM05ennard.png');
|
||||
this.load.image('CAM05ennard2','images/CAM05ennard2.png');
|
||||
this.load.image('CAM06','images/CAM06.png');
|
||||
this.load.image('CAM07','images/CAM07.png');
|
||||
this.load.image('CAM07ennard','images/CAM07ennard.png');
|
||||
|
||||
this.load.image('cameraButton','images/cameraButton.png');
|
||||
this.load.image('usageBar','images/usageBar.png');
|
||||
|
||||
this.load.spritesheet('ennardJs','images/ennardJs.png',{frameWidth: 1200,frameHeight:700});
|
||||
|
||||
|
||||
this.load.spritesheet('CAM01Button','images/CAM01Button.png',{frameWidth: 90,frameHeight:39});
|
||||
this.load.spritesheet('CAM02Button','images/CAM02Button.png',{frameWidth: 90,frameHeight:39});
|
||||
this.load.spritesheet('CAM03Button','images/CAM03Button.png',{frameWidth: 90,frameHeight:39});
|
||||
this.load.spritesheet('CAM04Button','images/CAM04Button.png',{frameWidth: 90,frameHeight:39});
|
||||
this.load.spritesheet('CAM05Button','images/CAM05Button.png',{frameWidth: 90,frameHeight:39});
|
||||
this.load.spritesheet('CAM06Button','images/CAM06Button.png',{frameWidth: 90,frameHeight:39});
|
||||
this.load.spritesheet('CAM07Button','images/CAM07Button.png',{frameWidth: 90,frameHeight:39});
|
||||
|
||||
|
||||
|
||||
this.load.audio('ambience', 'audio/ambience.mp3');
|
||||
this.load.audio('officeDoor', 'audio/officeDoor.mp3');
|
||||
this.load.audio('cameraFlip', 'audio/cameraFlip.mp3');
|
||||
this.load.audio('ennardJsSound', 'audio/ennardJs.mp3');
|
||||
this.load.audio('scrapBabyJumpscare', 'audio/scrapBabyJumpscare.mp3');
|
||||
this.load.audio('videoStatic', 'audio/videoStatic.mp3');
|
||||
this.load.audio('powerDownSound', 'audio/powerDownSound.mp3');
|
||||
this.load.audio('menuMusic', 'audio/menuMusic.mp3');
|
||||
this.load.audio('nightOnePhoneCall', 'audio/nightOnePhoneCall.mp3');
|
||||
this.load.audio('nightTwoPhoneCall', 'audio/nightTwoPhoneCall.mp3');
|
||||
this.load.audio('nightThreePhoneCall', 'audio/nightThreePhoneCall.mp3');
|
||||
this.load.audio('nightFourPhoneCall', 'audio/nightFourPhoneCall.mp3');
|
||||
this.load.audio('nightFivePhoneCall', 'audio/nightFivePhoneCall.mp3');
|
||||
this.load.audio('nightSixPhoneCall', 'audio/nightSixPhoneCall.mp3');
|
||||
/*
|
||||
this.load.audio('click', 'audio/click.mp3');*/
|
||||
}
|
||||
create() {
|
||||
var scene = this;
|
||||
this.scene.stop('UIScene');
|
||||
//set current scene to variable
|
||||
|
||||
//audio
|
||||
//config for keeping sound loop
|
||||
gameState.loopSound = {
|
||||
loop: true,
|
||||
volume: 1
|
||||
}
|
||||
gameState.lowLoopSound = {
|
||||
loop: true,
|
||||
volume: 0.7
|
||||
}
|
||||
gameState.reset();
|
||||
|
||||
gameState.loadSave();
|
||||
|
||||
|
||||
this.anims.create({
|
||||
key: 'mainMenuStaticAction',
|
||||
frameRate: 20,
|
||||
repeat: -1,
|
||||
frames:this.anims.generateFrameNames('mainMenuStatic',{start: 0,end: 12})
|
||||
});
|
||||
this.anims.create({
|
||||
key: 'officeBackgroundAction',
|
||||
frameRate: 20,
|
||||
repeat: -1,
|
||||
frames:this.anims.generateFrameNames('officeBackground',{start: 0,end: 4})
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.anims.create({
|
||||
key: 'rightDoorOpen',
|
||||
frameRate: 20,
|
||||
frames:this.anims.generateFrameNames('rightDoor',{start: 5,end: 9})
|
||||
});
|
||||
this.anims.create({
|
||||
key: 'rightDoorClose',
|
||||
frameRate: 20,
|
||||
frames:this.anims.generateFrameNames('rightDoor',{start: 0,end: 4})
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.anims.create({
|
||||
key: 'leftDoorOpen',
|
||||
frameRate: 15,
|
||||
frames:this.anims.generateFrameNames('leftDoor',{start: 5,end: 9})
|
||||
});
|
||||
this.anims.create({
|
||||
key: 'leftDoorClose',
|
||||
frameRate: 15,
|
||||
frames:this.anims.generateFrameNames('leftDoor',{start: 0,end: 4})
|
||||
});
|
||||
|
||||
|
||||
this.anims.create({
|
||||
key: 'ventDoorOpen',
|
||||
frameRate: 24,
|
||||
frames:this.anims.generateFrameNames('ventDoor',{start: 5,end: 9})
|
||||
});
|
||||
this.anims.create({
|
||||
key: 'ventDoorClose',
|
||||
frameRate: 24,
|
||||
frames:this.anims.generateFrameNames('ventDoor',{start: 0,end: 4})
|
||||
});
|
||||
|
||||
|
||||
this.anims.create({
|
||||
key: 'cameraMoniterOpen',
|
||||
frameRate: 24,
|
||||
frames:this.anims.generateFrameNames('cameraMoniter',{start: 0,end: 8})
|
||||
});
|
||||
this.anims.create({
|
||||
key: 'cameraMoniterClose',
|
||||
frameRate: 24,
|
||||
frames:this.anims.generateFrameNames('cameraMoniter',{start: 9,end: 15})
|
||||
});
|
||||
|
||||
this.anims.create({
|
||||
key: 'cameraStaticAction',
|
||||
frameRate: 20,
|
||||
repeat:-1,
|
||||
frames:this.anims.generateFrameNames('cameraStatic',{start: 0,end: 4})
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.anims.create({
|
||||
key: 'ennardJsAction',
|
||||
frameRate: 28,
|
||||
frames:this.anims.generateFrameNames('ennardJs',{start: 0,end: 16})
|
||||
});
|
||||
|
||||
this.anims.create({
|
||||
key: 'scrapBabyJumpscareAction',
|
||||
frameRate: 15,
|
||||
frames:this.anims.generateFrameNames('scrapBabyJumpscare',{start: 0,end: 11})
|
||||
});
|
||||
|
||||
|
||||
|
||||
var menuBg = this.add.image(-600,0,'mainMenuBackground').setOrigin(0,0);
|
||||
menuBg.scale = 1200/menuBg.width;
|
||||
|
||||
var menuMusic = this.sound.add('menuMusic');
|
||||
menuMusic.play(gameState.lowLoopSound);
|
||||
|
||||
var menuStatic = this.add.sprite(0,0,'mainMenuStatic').setOrigin(0,0);
|
||||
menuStatic.anims.play('mainMenuStaticAction','true');
|
||||
|
||||
var title = this.add.text(100, 100, `F I V E N I G H T S A T S I S T E R L O C A T I O N`, {
|
||||
fill: '#FFFFFF',
|
||||
fontSize: `30px`,
|
||||
fontFamily: 'LiberationSansNarrow',
|
||||
strokeThickness: .5,
|
||||
}).setInteractive();
|
||||
|
||||
var newGameText = this.add.text(850, 420, `N E W G A M E`, {
|
||||
fill: '#FFFFFF',
|
||||
fontSize: `30px`,
|
||||
fontFamily: 'LiberationSansNarrow',
|
||||
strokeThickness: .5,
|
||||
}).setInteractive();
|
||||
newGameText.on('pointerdown', function(pointer){
|
||||
menuMusic.stop();
|
||||
gameState.thingsToSave.night = 1;
|
||||
scene.scene.start('ArenaScene');
|
||||
});
|
||||
var menuTextLine1 = this.add.image(0,430,'menuTextLine').setOrigin(0,0);
|
||||
menuTextLine1.visible = false;
|
||||
newGameText.on('pointerover', function(pointer){
|
||||
menuTextLine1.visible = true;
|
||||
});
|
||||
newGameText.on('pointerout', function(pointer){
|
||||
menuTextLine1.visible = false;
|
||||
});
|
||||
|
||||
|
||||
var continueText = this.add.text(850, 510, `C O N T I N U E`, {
|
||||
fill: '#FFFFFF',
|
||||
fontSize: `25px`,
|
||||
fontFamily: 'LiberationSansNarrow',
|
||||
strokeThickness: .5,
|
||||
}).setInteractive();
|
||||
continueText.on('pointerdown', function(pointer){
|
||||
menuMusic.stop();
|
||||
scene.scene.start('ArenaScene');
|
||||
});
|
||||
var menuTextLine2 = this.add.image(0,519,'menuTextLine').setOrigin(0,0);
|
||||
menuTextLine2.visible = false;
|
||||
continueText.on('pointerover', function(pointer){
|
||||
menuTextLine2.visible = true;
|
||||
continueText.setText(`C O N T I N U E ${gameState.thingsToSave.night}`);
|
||||
});
|
||||
continueText.on('pointerout', function(pointer){
|
||||
menuTextLine2.visible = false;
|
||||
continueText.setText(`C O N T I N U E`);
|
||||
});
|
||||
//this.scene.start('ArenaScene');
|
||||
/*gameState.bgM = this.sound.add('menuBgMusic');
|
||||
gameState.bgM.setMute(false);
|
||||
gameState.bgM.play(gameState.loopSound,true);*/
|
||||
|
||||
|
||||
//Loading Animation
|
||||
|
||||
/*
|
||||
|
||||
//sets global scene to variable for inside local functions
|
||||
gameState.globalScene = this;
|
||||
//create and animate background
|
||||
var bg = this.physics.add.sprite(0,0,'background').setOrigin(0,0).setScale(window.innerHeight/675).setDepth(-100);
|
||||
bg.anims.play('bganimate','true');
|
||||
|
||||
//add title
|
||||
var title = this.add.sprite(window.innerWidth/2,120,'titleImage').setScale(1);
|
||||
this.time.addEvent({
|
||||
delay: 3000,
|
||||
callback: ()=>{
|
||||
title.anims.play('moveTitle');
|
||||
},
|
||||
startAt: 0,
|
||||
repeat: -1,
|
||||
timeScale: 1
|
||||
});
|
||||
|
||||
|
||||
var Ubutton = this.add.image(window.innerWidth/2+60,window.innerHeight/2+280,'upgradeButton').setInteractive();
|
||||
Ubutton.on('pointerdown', function(pointer){
|
||||
gameState.globalScene.scene.start('UpgradeScene');
|
||||
});
|
||||
Ubutton.on('pointerover', function(pointer){
|
||||
scene.sound.play('click',{volume: 5});
|
||||
Ubutton.setFrame(1);
|
||||
});
|
||||
Ubutton.on('pointerout', function(pointer){
|
||||
Ubutton.setFrame(0);
|
||||
});
|
||||
*/
|
||||
}
|
||||
update(){
|
||||
//game loop that constantly runs (not needed for menu)
|
||||
}
|
||||
}
|
||||