diff --git a/index.html b/index.html index 2244478..1c337bd 100644 --- a/index.html +++ b/index.html @@ -282,4 +282,10 @@ + + + + + + \ No newline at end of file diff --git a/scenes/act3_test.md b/scenes/act3_test.md new file mode 100644 index 0000000..a0fe660 --- /dev/null +++ b/scenes/act3_test.md @@ -0,0 +1,218 @@ +# act3 + +`SceneSetup.act3();` + +h: meow + +r: blah blah blah blah blah blah blah blah blah blah blah blah + +``` +Game.clearText(); +publish("act3-out"); +music('battle_dark', {volume:0.7, fade:1}); +``` + +(...1500) + +``` +publish("hp_show"); +``` + +n: FINAL ROUND: *FIGHT!* + +h: Yelling + +b: Yelling + +``` +Game.clearText(); +publish("act3-in"); +publish("hp_hide"); +Game.FORCE_CANT_SKIP = true; +music(null,{fade:1}); +``` + +(#act3_walkaway) + +# act3_walkaway + +`publish("start-walkaway-anim");` + +(...2001) + +`publish('hong-next')` + +(...667) + +`publish('hong-next')` + +(...667) + +`publish('hong-next')` + +(...667) + +`publish('hong-next')` + +`Game.FORCE_CANT_SKIP = false;` + +r: What's the matter, kid? + +r: Ya *scared?* + +``` +publish('hong-next'); +publish('hunter-bored'); +``` + +h2: Yes. + +h2: I'm scared. + +`publish('hong-next')` + +h2: And that's okay! + +`publish('hong-next')` + +h2: It's okay to be scared. + +`publish('hong-next')` + +(...500) + +``` +Game.clearText(); +Game.FORCE_CANT_SKIP = true; +``` + +(...1167) + +`publish('hong-next')` + +(...833) + +`publish('hong-next')` + +(...1333) + +`publish('hong-next')` + +(...667) + +`publish('hong-next')` + +(...667) + +`publish('hong-next')` + +(...1333) + +`publish('hong-next')` + +(...501) + +`publish('hong-next')` + +`Game.FORCE_CANT_SKIP = false;` + +(...1001) + +r: Did they just lock the door? + +r: ... + +r: shit. + + + + + +# act3_jump + +`publish("start-jump-anim");` + +(...2001) + +`publish('hong-next')` + +(...833) + +`publish('hong-next')` + +(...501) + +`publish('hong-next')` + +(...501) + +`publish('hong-next')` + +(...1167) + +`publish('hong-next')` + +(...1001) + +`publish('hong-next')` + +b: no... + +`publish('hong-next')` + +(...501) + +`Game.clearText();` + +(...1333) + +`publish('hong-next')` + +(...1333) + +`publish('hong-next')` + +b: no no no + +(...501) + +`Game.clearText();` + +`publish('hong-next')` + +(...2001) + +`publish('hong-next')` + +(...501) + +`publish('hong-next')` + +(...167) + +`publish('hong-next')` + +(...167) + +`publish('hong-next')` + +(...167) + +``` +publish('hong-next'); +publish("hunter-shock"); +``` + +(...833) + +`publish('hong-next')` + +(...167) + +`publish('hong-next')` + +(...167) + +`publish('hong-next')` + +b: NO! \ No newline at end of file diff --git a/scripts/act2/Act2_SceneSetup.js b/scripts/act2/Act2_SceneSetup.js index 2dd8d8e..2ed368f 100644 --- a/scripts/act2/Act2_SceneSetup.js +++ b/scripts/act2/Act2_SceneSetup.js @@ -9,7 +9,7 @@ SceneSetup.act2 = function(){ // RESET HP HP.reset(); - // ATTACKS + // ATTACKS (TODO: ACT I, ACT II...???) _.attack_harm = 0; _.attack_alone = 0; _.attack_bad = 0; diff --git a/scripts/act3/Act3_BG.js b/scripts/act3/Act3_BG.js new file mode 100644 index 0000000..c1330b2 --- /dev/null +++ b/scripts/act3/Act3_BG.js @@ -0,0 +1,186 @@ +Loader.addImages([ + { id:"rooftop_bg", src:"sprites/act3/rooftop_bg.png" }, + { id:"rooftop_hunter", src:"sprites/act3/hunter.png" }, + { id:"rooftop_hong", src:"sprites/act3/hong.png" } +]); + +function BG_Rooftop(){ + + var self = this; + + // Sprites! + self.bgSprite = new Sprite({ + image: Library.images.rooftop_bg, + grid:{ width:1, height:1 }, + frame:{ width:720, height:1200 }, + }); + self.hunterSprite = new Sprite({ + image: Library.images.rooftop_hunter, + grid:{ width:4, height:1 }, + frame:{ width:400, height:400 }, + y: 200, + frameNames:[ + "side_smile", + "side_neutral", + "front_evil", + "front_shock" + ] + }); + self.hongSprite = new Sprite({ + image: Library.images.rooftop_hong, + grid:{ width:6, height:7 }, + frame:{ width:720, height:800 }, + y: 225 + }); + self.hongSprite.gotoFrame(3); + + // Anxiety BG + self.anxiety = new BG_Anxiety(); + + // Characters + self.hong = new Act3_Hong(); + self.beebee = new Act3_Beebee(); + + // LAYERS + self.layers = [ + self.bgSprite, + self.hunterSprite, + self.anxiety, + self.hongSprite, + self.hong, + self.beebee + ]; + var PARALLAXES = [ + 0.5, // party bg + 0.6, // HUNTER SPRITE + 0.0, // anxiety bg + 1.0, // HONG SPRITE + 0.0, // battle hong + 0.0, // battle beebee + ]; + var ALPHAS = [ + 1.0, // party bg + 1.0, // HUNTER SPRITE + 0.0, // anxiety bg + 1.0, // HONG SPRITE + 0.0, // battle hong + 0.0, // battle beebee + ]; + + var parallax = 0; + var parallaxTicker = 0; + var PARALLAXING = null; + self.update = function(){ + + // START PARALLAXING IN / OUT + if(PARALLAXING!=null){ + + if(PARALLAXING=="out"){ + parallaxTicker += 1/60; // 0 to 1 in one second + } + if(PARALLAXING=="in"){ + parallaxTicker -= 1/60; // 1 to 0 in one second + } + if(parallaxTicker>1) parallaxTicker = 1; + if(parallaxTicker<0) parallaxTicker = 0; + + // 0 to -180 in one second, smoothed + var t = Math.cos(parallaxTicker*Math.TAU/2); // 1 to -1 + t = (1-t)/2; // 0 to 1 + parallax = -t*190; + + // Anxiety Alpha + ALPHAS[2] = t; + + // DONE + if(t==1 || t==0){ + PARALLAXING = null; + + // Stage 1 transition end + if(STAGE==1){ + console.log("done"); + ALPHAS[1] = 0; // HIDE Hunter + ALPHAS[3] = 0; // HIDE Old Hong + ALPHAS[4] = 1; // SHOW new hong + ALPHAS[5] = 1; // SHOW Beebee + } + + } + + } + + // Anxiety BG + if(ALPHAS[2]>0){ + self.anxiety.update(ALPHAS[2]); + if(ALPHAS[2]==1){ // if fully visible... + ALPHAS[0] = 0; // hide everything under + }else{ + ALPHAS[0] = 1; // show everything under + } + } + + }; + + self.draw = function(ctx){ + + ctx.save(); + + for(var i=0; i0){ + ctx.globalAlpha = ALPHAS[i]; + layer.draw(ctx); + } + } + + ctx.restore(); + + }; + + var STAGE = 0; + var _subscriptions = []; + _subscriptions.push( + subscribe("act3-out", function(){ + STAGE = 1; + PARALLAXING = "out"; + sfx("whoosh"); // WHOOSH + }), + subscribe("act3-in", function(){ + + // SHOW ACTION, HIDE CHARS + ALPHAS[1] = 1; // SHOW Hunter + ALPHAS[3] = 1; // SHOW Roof Hong + ALPHAS[4] = 0; // HIDE battle Hong + ALPHAS[5] = 0; // HIDE battle Beebee + + // WHOOSH + STAGE = 2; + PARALLAXING = "in"; + sfx("whoosh"); + + }), + + // JUMP OFF + subscribe("start-jump-anim", function(){ + self.hongSprite.gotoFrame(4); + self.hunterSprite.gotoFrameByName("front_evil"); + }), + subscribe("hong-next", function(){ + self.hongSprite.nextFrame(); + }), + subscribe("hunter-shock", function(){ + self.hunterSprite.gotoFrameByName("front_shock"); + }), + + // WALK AWAY + subscribe("start-walkaway-anim", function(){ + self.hongSprite.gotoFrame(23); + self.hunterSprite.gotoFrameByName("side_smile"); + }), + subscribe("hunter-bored", function(){ + self.hunterSprite.gotoFrameByName("side_neutral"); + }) + ); + +} \ No newline at end of file diff --git a/scripts/act3/Act3_Beebee.js b/scripts/act3/Act3_Beebee.js new file mode 100644 index 0000000..23836ac --- /dev/null +++ b/scripts/act3/Act3_Beebee.js @@ -0,0 +1,77 @@ +Loader.addImages([ + { id:"act3_bb", src:"sprites/act3/fight_bb.png" } +]); + +function Act3_Beebee(){ + + var self = this; + + // SPRITE CONFIG! + var spriteConfig = { + image: Library.images.act3_bb, + grid:{ + width: 4, + height: 2 + }, + frame:{ + width: 720, + height: 500 + }, + anchor:{ + x: 270, + y: 222 + }, + frameNames:[ + "body_scared*", + "body_sad*", + "body_attacked*", + "body_dead*", + "eyes_blank", + "mouth_blank", + ], + x: 270, + y: 258+222-60 + }; + + // ANIM LOOPS + var animLoops = []; + + // Inherit from Character! + Character.apply(self, [spriteConfig, animLoops]); + + // Go To Frames! + self.gotoFrames({ + body: "scared", + mouth: "blank", + eyes: "blank", + }); + var _subscriptions = []; + _subscriptions.push( subscribe("bb", self.gotoFrames) ); + _subscriptions.push( subscribe("attack_bb", self.showAttackedIcon) ); + + // Draw! Same as earlier except a lot of vibration + var ticker = 0; + var _oldDraw = self.draw; + self.characterSpeakerID = "b"; + self.bounceHookes = 0.25; // loose + self.bounceDamp = 0.9; // loose + self.draw = function(ctx){ + + // Vibration! + ticker += 1/60; + self.characterSquash = 1 + Math.sin(ticker*Math.TAU*7)*0.01; // seven vibes per second + + // Old Draw + _oldDraw.apply(self, arguments); + + }; + ////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// + + // Kill! + self.kill = function(){ + _subscriptions.forEach(unsubscribe); + }; + +} \ No newline at end of file diff --git a/scripts/act3/Act3_Hong.js b/scripts/act3/Act3_Hong.js new file mode 100644 index 0000000..99d4bf7 --- /dev/null +++ b/scripts/act3/Act3_Hong.js @@ -0,0 +1,64 @@ +Loader.addImages([ + { id:"act3_hong", src:"sprites/act3/fight_hong.png" } +]); + +function Act3_Hong(){ + + var self = this; + + // SPRITE CONFIG! + var spriteConfig = { + image: Library.images.act3_hong, + grid:{ + width: 4, + height: 1 + }, + frame:{ + width: 720, + height: 400 + }, + anchor:{ + x: 59, + y: 180 + }, + frameNames:[ + "body_angry*", + "body_drink*", + "body_stop*", + "body_foobar*", + "mouth_blank", + "eyes_blank", + ], + x: 59, + y: 258+180 + }; + + // ANIM LOOPS + var animLoops = []; + + // Inherit from Character! + Character.apply(self, [spriteConfig, animLoops]); + + // Go To Frames! + self.gotoFrames({ + body: "angry", + mouth: "blank", + eyes: "blank", + }); + var _subscriptions = []; + _subscriptions.push( subscribe("hong", self.gotoFrames) ); + //_subscriptions.push( subscribe("attack_hong", self.showAttackedIcon) ); + + // Draw + self.characterSpeakerID = "h"; + + ////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// + + // Kill! + self.kill = function(){ + _subscriptions.forEach(unsubscribe); + }; + +} \ No newline at end of file diff --git a/scripts/act3/Act3_SceneSetup.js b/scripts/act3/Act3_SceneSetup.js new file mode 100644 index 0000000..cf9cf36 --- /dev/null +++ b/scripts/act3/Act3_SceneSetup.js @@ -0,0 +1,25 @@ +Loader.addSounds([ + { id:"music_party2", src:"sounds/music/party2.mp3" }, + { id:"music_battle_dark", src:"sounds/music/battle_dark.mp3" } +]); + +SceneSetup.act3 = function(){ + + Game.resetScene(); + + // RESET HP + HP.reset(); + + // ATTACKS + _.attack_harm = 0; + _.attack_alone = 0; + _.attack_bad = 0; + + // Music + music('party2', {volume:0.6}); + + // Background + var bg = new BG_Rooftop(); + Game.scene.children.push(bg); + +}; \ No newline at end of file diff --git a/scripts/game/Game.js b/scripts/game/Game.js index 9b8012a..4434d84 100644 --- a/scripts/game/Game.js +++ b/scripts/game/Game.js @@ -699,7 +699,7 @@ Game.executeWait = function(line){ // Specific wait-time, don't skip? var waitTimeString = waitTime+""; var lastDigit = waitTimeString[waitTimeString.length-1]; - var cantSkip = (lastDigit=="1"); // CAN'T SKIP. + var cantSkip = (lastDigit!="0"); // CAN'T SKIP. if(!cantSkip && Game.CLICK_TO_ADVANCE && waitTime<999){ // hack: unless the wait is long. waitTime = 0; diff --git a/scripts/game/Sprite.js b/scripts/game/Sprite.js index 86a3cb6..555477d 100644 --- a/scripts/game/Sprite.js +++ b/scripts/game/Sprite.js @@ -53,6 +53,9 @@ function Sprite(config){ self.currentFrame = index; self.currentFrameName = self.frameNames[self.currentFrame] || ""; }; + self.nextFrame = function(){ + self.gotoFrame(self.currentFrame+1); + }; self.gotoFrameByName = function(name){ var index = self.frameNames.indexOf(name); self.gotoFrame(index); diff --git a/scripts/main.js b/scripts/main.js index 86571d1..1864441 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -4,7 +4,8 @@ Loader.addScenes([ //"scenes/act1.md", //"scenes/act1_end.md", //"scenes/PROMO.md" - "scenes/act2.md", + //"scenes/act2.md", + "scenes/act3_test.md", ]); Loader.load(function(progress){ @@ -27,6 +28,6 @@ subscribe("START_GAME", function(){ $("#loading").style.display = "none"; Game.start(); - Game.goto("act2"); + Game.goto("act3"); }); \ No newline at end of file diff --git a/sounds/music/battle_dark.mp3 b/sounds/music/battle_dark.mp3 new file mode 100644 index 0000000..55c3202 Binary files /dev/null and b/sounds/music/battle_dark.mp3 differ diff --git a/sounds/music/party2.mp3 b/sounds/music/party2.mp3 new file mode 100644 index 0000000..69661c7 Binary files /dev/null and b/sounds/music/party2.mp3 differ diff --git a/sprites/act3/fight_bb.png b/sprites/act3/fight_bb.png new file mode 100644 index 0000000..9e1923a Binary files /dev/null and b/sprites/act3/fight_bb.png differ diff --git a/sprites/act3/fight_hong.png b/sprites/act3/fight_hong.png new file mode 100644 index 0000000..29355a2 Binary files /dev/null and b/sprites/act3/fight_hong.png differ diff --git a/sprites/act3/hong.png b/sprites/act3/hong.png new file mode 100644 index 0000000..36ec55f Binary files /dev/null and b/sprites/act3/hong.png differ diff --git a/sprites/act3/hospital.png b/sprites/act3/hospital.png new file mode 100644 index 0000000..1758101 Binary files /dev/null and b/sprites/act3/hospital.png differ diff --git a/sprites/act3/hunter.png b/sprites/act3/hunter.png new file mode 100644 index 0000000..beeb15f Binary files /dev/null and b/sprites/act3/hunter.png differ diff --git a/sprites/act3/rooftop_bg.png b/sprites/act3/rooftop_bg.png new file mode 100644 index 0000000..1791d56 Binary files /dev/null and b/sprites/act3/rooftop_bg.png differ