chapter select and save and load
This commit is contained in:
parent
f6033dd274
commit
9a61042d58
|
@ -28,7 +28,7 @@ n: QUICK, WARN THEM!
|
|||
|
||||
b: Human! Listen, we're in danger! The danger is...
|
||||
|
||||
n4: (LET *YOUR* ANXIETY COME OUT TO PLAY! PICK WHAT'S MOST SIMILAR TO WHAT *YOUR* FEAR TELLS YOU:)
|
||||
n4: (LET _YOUR_ ANXIETY COME OUT TO PLAY! PICK WHAT'S MOST SIMILAR TO WHAT _YOUR_ FEAR TELLS YOU)
|
||||
|
||||
[We're eating alone for lunch! Again!](#act1a_alone)
|
||||
|
||||
|
@ -412,7 +412,7 @@ h: What's new on Twitter?
|
|||
|
||||
[Oh no, is that tweet secretly about *us?*](#act1d_subtweet)
|
||||
|
||||
[Hey, a GIF of a cat drinking milk.](#act1d_milk)
|
||||
[Hey, a GIF of a cat drinking milk](#act1d_milk)
|
||||
|
||||
|
||||
# act1d_news
|
||||
|
|
|
@ -606,7 +606,7 @@ h: *"Don't worry, be happy!"*
|
|||
|
||||
`hong({ body:"normal", mouth:"normal", eyes:"normal" });`
|
||||
|
||||
h: All the wise folk of our time agree: negative emotions are *bad!*
|
||||
h: The sages all knew that simple Stoic truth: negative emotions are *bad!*
|
||||
|
||||
`hong({ eyes:"less_angry" });`
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
```
|
||||
SceneSetup.act4();
|
||||
/*Game.FORCE_CANT_SKIP = true;*/
|
||||
publish("SAVE_GAME", ["act4"]);
|
||||
Game.FORCE_CANT_SKIP = true;
|
||||
```
|
||||
|
||||
(...5001)
|
||||
|
@ -203,7 +204,7 @@ h: So what the hell was the moral of this story?
|
|||
|
||||
`hong({body:"one_up", eyes:"annoyed"})`
|
||||
|
||||
h: What did we even *learn*? I *was* being stupid, my "friends" *were* using me, and we almost goddamn *died*.
|
||||
h: What did we even *learn*? I *was* being stupid, my "friends" *were* using me, and we almost frickin' *died*.
|
||||
|
||||
`hong({body:"normal", eyes:"normal"})`
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
```
|
||||
Game.FORCE_CANT_SKIP = true;
|
||||
music('credits', {NO_LOOP:true, volume:0.45});
|
||||
music('credits', {NO_LOOP:true, volume:0.43});
|
||||
window.localStorage.setItem("continueChapter", "replay"); /* to Continue */
|
||||
window.localStorage.setItem("credits", "YUP!"); /* for chapter select */
|
||||
```
|
||||
|
||||
(...1901)
|
||||
|
|
|
@ -4,9 +4,71 @@
|
|||
|
||||
# intro-play-button
|
||||
|
||||
`Game.OVERRIDE_FONT_SIZE=30;`
|
||||
```
|
||||
_.PLAYED_BEFORE = !!window.localStorage.continueChapter;
|
||||
```
|
||||
|
||||
[<div class="mini-icon" pic="play1"></div> PLAY! <div class="mini-icon" pic="play2"></div>](#intro-start) `publish("intro-to-game-1"); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{if !_.PLAYED_BEFORE}}
|
||||
`Game.OVERRIDE_FONT_SIZE=30;`
|
||||
{{/if}}
|
||||
|
||||
{{if !_.PLAYED_BEFORE}}
|
||||
[PLAY!](#intro-start) `publish("intro-to-game-1"); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{/if}}
|
||||
|
||||
{{if _.PLAYED_BEFORE && window.localStorage.continueChapter=="act2"}}
|
||||
[CONTINUE: The Party](#act2) `publish("LOAD_GAME", ["act2"]); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{/if}}
|
||||
|
||||
{{if _.PLAYED_BEFORE && window.localStorage.continueChapter=="act3"}}
|
||||
[CONTINUE: The Other Party](#act3) `publish("LOAD_GAME", ["act3"]); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{/if}}
|
||||
|
||||
{{if _.PLAYED_BEFORE && window.localStorage.continueChapter=="act4"}}
|
||||
[CONTINUE: The Other Sandwich](#act4) `publish("LOAD_GAME", ["act4"]); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{/if}}
|
||||
|
||||
{{if _.PLAYED_BEFORE && window.localStorage.continueChapter=="replay"}}
|
||||
`Game.OVERRIDE_FONT_SIZE=30;`
|
||||
{{/if}}
|
||||
|
||||
{{if _.PLAYED_BEFORE && window.localStorage.continueChapter=="replay"}}
|
||||
[REPLAY!](#intro-start) `publish("intro-to-game-1"); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{/if}}
|
||||
|
||||
{{if _.PLAYED_BEFORE}}
|
||||
[Chapter Select](#chapter-select) `Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{/if}}
|
||||
|
||||
[(content notes)](#content-notes) `Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
|
||||
# chapter-select
|
||||
|
||||
`publish("HACK_chselect");`
|
||||
|
||||
[I. The Sandwich](#intro-start) `publish("HACK_chselect_end"); publish("intro-to-game-1"); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
|
||||
[II. The Party](#act2) `publish("HACK_chselect_end"); publish("LOAD_GAME", ["act2"]); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
|
||||
{{if window.localStorage.act3}}
|
||||
[III. The Other Party](#act3) `publish("HACK_chselect_end"); publish("LOAD_GAME", ["act3"]); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{/if}}
|
||||
|
||||
{{if !window.localStorage.act3}}
|
||||
[III. The Other Party]()
|
||||
{{/if}}
|
||||
|
||||
{{if window.localStorage.act4}}
|
||||
[IV. The Other Sandwich](#act4) `publish("HACK_chselect_end"); publish("LOAD_GAME", ["act4"]); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
{{/if}}
|
||||
|
||||
{{if !window.localStorage.act4}}
|
||||
[III. The Other Sandwich]()
|
||||
{{/if}}
|
||||
|
||||
[V. Credits](#credits) `publish("HACK_chselect_end"); stopAllSounds(); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
|
||||
[(main menu)](#intro-play-button) `publish("HACK_chselect_end"); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||
|
||||
# intro-start
|
||||
|
||||
|
|
|
@ -146,6 +146,7 @@ var _unpauseOrSkip = function(){
|
|||
Game.onUnpause();
|
||||
}else{
|
||||
Game.clearAllTimeouts();
|
||||
publish("super_hack_skip_intro");
|
||||
}
|
||||
};
|
||||
window.addEventListener("click", _unpauseOrSkip);
|
||||
|
@ -650,7 +651,13 @@ Game.OVERRIDE_FONT_SIZE = false;
|
|||
Game.executeChoice = function(line){
|
||||
|
||||
var choiceText = line.match(/\[([^\]]*)\]/)[1].trim();
|
||||
var choiceID = line.match(/\(\#([^\)]*)\)/)[1].trim().toLocaleLowerCase();
|
||||
var choiceID = line.match(/\(\#([^\)]*)\)/);
|
||||
var THERE_IS_NO_CHOICE;
|
||||
if(!choiceID){
|
||||
THERE_IS_NO_CHOICE = true;
|
||||
}else{
|
||||
choiceID = choiceID[1].trim().toLocaleLowerCase();
|
||||
}
|
||||
|
||||
var preChoiceCodeIfAny = null;
|
||||
if(/\`(.*)\`/.test(line)){
|
||||
|
@ -671,35 +678,39 @@ Game.executeChoice = function(line){
|
|||
var div = document.createElement("div");
|
||||
div.innerHTML = choiceText;
|
||||
div.setAttribute("speaker", Game.OVERRIDE_CHOICE_SPEAKER ? Game.OVERRIDE_CHOICE_SPEAKER : "b");
|
||||
div.onclick = function(event){
|
||||
if(!THERE_IS_NO_CHOICE){
|
||||
div.onclick = function(event){
|
||||
|
||||
// Any pre-choice code?
|
||||
if(preChoiceCodeIfAny) Game.executeCode(preChoiceCodeIfAny);
|
||||
// Any pre-choice code?
|
||||
if(preChoiceCodeIfAny) Game.executeCode(preChoiceCodeIfAny);
|
||||
|
||||
// Override line... ONCE
|
||||
if(!Game.OVERRIDE_CHOICE_LINE){
|
||||
if(Game.OVERRIDE_CHOICE_SPEAKER){
|
||||
Game.addToQueue(Game.OVERRIDE_CHOICE_SPEAKER+": "+originalChoiceText);
|
||||
}else{
|
||||
Game.addToQueue("b: "+originalChoiceText);
|
||||
// Override line... ONCE
|
||||
if(!Game.OVERRIDE_CHOICE_LINE){
|
||||
if(Game.OVERRIDE_CHOICE_SPEAKER){
|
||||
Game.addToQueue(Game.OVERRIDE_CHOICE_SPEAKER+": "+originalChoiceText);
|
||||
}else{
|
||||
Game.addToQueue("b: "+originalChoiceText);
|
||||
}
|
||||
}
|
||||
}
|
||||
Game.OVERRIDE_CHOICE_SPEAKER = null;
|
||||
Game.OVERRIDE_CHOICE_LINE = false;
|
||||
Game.OVERRIDE_CHOICE_SPEAKER = null;
|
||||
Game.OVERRIDE_CHOICE_LINE = false;
|
||||
|
||||
// Play sound
|
||||
sfx("ui_click");
|
||||
// Play sound
|
||||
sfx("ui_click");
|
||||
|
||||
// Goto that choice, now!
|
||||
Game.goto(choiceID);
|
||||
// Goto that choice, now!
|
||||
Game.goto(choiceID);
|
||||
|
||||
// STOP THE PROP
|
||||
event.stopPropagation();
|
||||
// STOP THE PROP
|
||||
event.stopPropagation();
|
||||
|
||||
};
|
||||
div.onmouseover = function(){
|
||||
sfx("ui_hover");
|
||||
};
|
||||
};
|
||||
div.onmouseover = function(){
|
||||
sfx("ui_hover");
|
||||
};
|
||||
}else{
|
||||
div.setAttribute("speaker", Game.OVERRIDE_CHOICE_SPEAKER ? Game.OVERRIDE_CHOICE_SPEAKER : "none");
|
||||
}
|
||||
|
||||
// Add choice, animated!
|
||||
div.style.top = "150px";
|
||||
|
@ -807,7 +818,7 @@ Game.executeGoto = function(line){
|
|||
Game.getLineType = function(line){
|
||||
|
||||
// Is it a choice?
|
||||
var isChoice = /\[.*\]\(\#.*\)/.test(line);
|
||||
var isChoice = /\[.*\]\(.*\)/.test(line);
|
||||
if(isChoice) return "choice";
|
||||
|
||||
// Is it a goto?
|
||||
|
|
|
@ -22,6 +22,13 @@ SceneSetup.intermission = function(STAGE){
|
|||
Game.FORCE_CANT_SKIP = true;
|
||||
Game.NO_NARRATOR_SOUNDS = true;
|
||||
$("#click_to_advance").style.color = "#000";
|
||||
|
||||
// SAVE
|
||||
if(_.INTERMISSION_STAGE==1){ // between Act I and II
|
||||
publish("SAVE_GAME", ["act2"]);
|
||||
}else if(_.INTERMISSION_STAGE==2){ // between Act II and III
|
||||
publish("SAVE_GAME", ["act3"]);
|
||||
}
|
||||
|
||||
// KILL
|
||||
Game.scene.kill = function(){
|
||||
|
|
|
@ -20,8 +20,7 @@ Loader.addSounds([
|
|||
|
||||
function BG_Intro(){
|
||||
|
||||
var ticker = 0; //18;//0;
|
||||
|
||||
var ticker = 0; // 18; // SKIP
|
||||
|
||||
var self = this;
|
||||
|
||||
|
@ -203,6 +202,13 @@ function BG_Intro(){
|
|||
|
||||
})
|
||||
);
|
||||
_subscriptions.push(
|
||||
subscribe("super_hack_skip_intro", function(){
|
||||
if(ticker>0.1 && ticker<18){
|
||||
frameTicker = ticker = 18;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -18,4 +18,11 @@ SceneSetup.intro = function(){
|
|||
$("#gear").style.display = "none";
|
||||
$("#about").style.display = "none";
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
subscribe("HACK_chselect", function(){
|
||||
Game.choicesDOM.style.height = "250px";
|
||||
});
|
||||
subscribe("HACK_chselect_end", function(){
|
||||
Game.choicesDOM.style.height = "130px";
|
||||
});
|
|
@ -35,7 +35,7 @@ subscribe("START_GAME", function(){
|
|||
$("#about").style.display = "block";
|
||||
|
||||
// Intro
|
||||
//Game.goto("intro");
|
||||
Game.goto("intro");
|
||||
|
||||
//Game.TEXT_SPEED = 5;
|
||||
|
||||
|
@ -52,10 +52,22 @@ subscribe("START_GAME", function(){
|
|||
//Game.goto("act4");
|
||||
|
||||
// Credits
|
||||
Game.goto("credits");
|
||||
//Game.goto("credits");
|
||||
|
||||
});
|
||||
|
||||
subscribe("SAVE_GAME", function(nextChapter){
|
||||
var json = JSON.stringify(_);
|
||||
window.localStorage.setItem("continueChapter", nextChapter); // to Continue
|
||||
window.localStorage.setItem(nextChapter, json); // for chapter select
|
||||
});
|
||||
|
||||
subscribe("LOAD_GAME", function(fromNextChapter){
|
||||
_ = JSON.parse(window.localStorage.getItem(fromNextChapter)); // LOAD IT!
|
||||
});
|
||||
|
||||
// TODO: also save Sound options???
|
||||
|
||||
window._SAVE = function(){
|
||||
copy(JSON.stringify(_));
|
||||
};
|
||||
|
|
|
@ -929,6 +929,14 @@ DIALOGUEZ
|
|||
-o-transition-timing-function: cubic-bezier(0.350, 0.005, 0.370, 1.390);
|
||||
transition-timing-function: cubic-bezier(0.350, 0.005, 0.370, 1.390); /* custom */
|
||||
}
|
||||
#game_choices > div[speaker=none]{
|
||||
background: #000;
|
||||
color: #fff;
|
||||
font-weight: lighter;
|
||||
opacity: 0.5;
|
||||
text-decoration: line-through;
|
||||
cursor: default;
|
||||
}
|
||||
#game_choices > div[speaker=b]{
|
||||
background: #000;
|
||||
color: #fff;
|
||||
|
|
Loading…
Reference in New Issue