sound and misc fixes
This commit is contained in:
parent
3b63db6753
commit
c05b905eb4
|
@ -17,7 +17,8 @@
|
||||||
|
|
||||||
<!-- Click to Advance-->
|
<!-- Click to Advance-->
|
||||||
<div id="click_to_advance">
|
<div id="click_to_advance">
|
||||||
👆click anywhere
|
<span id="cta_text1">👆click anywhere</span>
|
||||||
|
<span id="cta_text2">⚪️</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Bottom Corner Tabs -->
|
<!-- Bottom Corner Tabs -->
|
||||||
|
|
|
@ -306,11 +306,11 @@ b: or even worse... WHITE BREAD
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if _.whitebread}}
|
{{if _.whitebread}}
|
||||||
b: You'll overdose on so much meth and white bread they won't be able to fit your fat corpse into the cremation furnace.
|
b: You'll overdose on so much meth and white bread they won't be able to fit your fat corpse into the cremation furnace!
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if !_.whitebread}}
|
{{if !_.whitebread}}
|
||||||
b: You'll overdose on so many drugs the undertaker will wonder how your body was *already* embalmed.
|
b: You'll overdose on so many drugs the undertaker will wonder how your body was *already* pre-embalmed!
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -424,7 +424,7 @@ bb({eyes:"pained2"});
|
||||||
hong({mouth:"sad", eyes:"sad"});
|
hong({mouth:"sad", eyes:"sad"});
|
||||||
```
|
```
|
||||||
|
|
||||||
b: It feels like it's all ending, like everything's dying and we're doomed and there's nothing anyone can do about it.
|
b: It feels like it's all ending, like everything's dying and we're doomed and there's nothing we can do about it.
|
||||||
|
|
||||||
```
|
```
|
||||||
Game.OVERRIDE_TEXT_SPEED = 0.5;
|
Game.OVERRIDE_TEXT_SPEED = 0.5;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
# intro-play-button
|
# intro-play-button
|
||||||
|
|
||||||
[Play!](#intro-start) `publish("intro-to-game-1"); Game.OVERRIDE_CHOICE_LINE=true;`
|
[👉 Play! 👈](#intro-start) `publish("intro-to-game-1"); Game.OVERRIDE_CHOICE_LINE=true;`
|
||||||
|
|
||||||
# intro-start
|
# intro-start
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
window.About = {};
|
window.About = {};
|
||||||
|
|
||||||
|
Loader.addSounds([
|
||||||
|
{ id:"yelp", src:"sounds/sfx/yelp.mp3" }
|
||||||
|
]);
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
// Newsletter stuff
|
// Newsletter stuff
|
||||||
|
@ -27,6 +31,8 @@ window.About = {};
|
||||||
};
|
};
|
||||||
$("#close_about").onclick = function(){
|
$("#close_about").onclick = function(){
|
||||||
|
|
||||||
|
sfx("ui_click");
|
||||||
|
|
||||||
aboutDOM.style.top = "";
|
aboutDOM.style.top = "";
|
||||||
//aboutDOM.setAttribute("about","yes");
|
//aboutDOM.setAttribute("about","yes");
|
||||||
|
|
||||||
|
@ -54,7 +60,8 @@ window.About = {};
|
||||||
// Replay
|
// Replay
|
||||||
$("#replay").onclick = function(){
|
$("#replay").onclick = function(){
|
||||||
|
|
||||||
// TODO: UI/SCREAM SOUNDS
|
// UI/SCREAM SOUNDS
|
||||||
|
sfx("yelp");
|
||||||
|
|
||||||
// Cut out
|
// Cut out
|
||||||
aboutDOM.style.top = "";
|
aboutDOM.style.top = "";
|
||||||
|
|
|
@ -148,7 +148,7 @@ Game.setTimeout = function(callback, interval){
|
||||||
timeLeft: interval
|
timeLeft: interval
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// TODO: SKIP TEXT WHEN CLICK ANYWHERE (but NOT capture in choice)
|
// SKIP TEXT WHEN CLICK ANYWHERE (but NOT capture in choice)
|
||||||
Game.clearAllTimeouts = function(){
|
Game.clearAllTimeouts = function(){
|
||||||
|
|
||||||
// Is this DURING while someone is talking?
|
// Is this DURING while someone is talking?
|
||||||
|
@ -389,6 +389,9 @@ Game.executeText = function(line){
|
||||||
if(speaker=="b"){
|
if(speaker=="b"){
|
||||||
voice("beebee", {volume:0.5});
|
voice("beebee", {volume:0.5});
|
||||||
}
|
}
|
||||||
|
if(speaker=="n3"){
|
||||||
|
voice("typewriter", {volume:0.5});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
window.Options = {};
|
window.Options = {};
|
||||||
|
|
||||||
|
Loader.addSounds([
|
||||||
|
{ id:"ui_button1", src:"sounds/ui/button1.mp3" },
|
||||||
|
{ id:"ui_button2", src:"sounds/ui/button2.mp3" }
|
||||||
|
]);
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
var optionsDOM = $("#options");
|
var optionsDOM = $("#options");
|
||||||
|
@ -22,8 +27,24 @@ window.Options = {};
|
||||||
}
|
}
|
||||||
Game.CLICK_TO_ADVANCE = !Game.CLICK_TO_ADVANCE;
|
Game.CLICK_TO_ADVANCE = !Game.CLICK_TO_ADVANCE;
|
||||||
text_automatic_toggle.innerHTML = Game.CLICK_TO_ADVANCE ? "on click" : "automatically";
|
text_automatic_toggle.innerHTML = Game.CLICK_TO_ADVANCE ? "on click" : "automatically";
|
||||||
|
|
||||||
|
// Sound
|
||||||
|
sfx( Game.CLICK_TO_ADVANCE ? "ui_button2" : "ui_button1");
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add sounds to slider
|
||||||
|
var addSoundsToSlider = function(slider){
|
||||||
|
var _play1 = function(){ sfx("ui_button1"); };
|
||||||
|
var _play2 = function(){ sfx("ui_button2"); };
|
||||||
|
slider.addEventListener("mousedown", _play1);
|
||||||
|
slider.addEventListener("touchstart", _play1);
|
||||||
|
slider.addEventListener("change", _play2);
|
||||||
|
//slider.addEventListener("touchend", _play2);
|
||||||
|
};
|
||||||
|
addSoundsToSlider(text_speed_slider);
|
||||||
|
addSoundsToSlider(volume_slider);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
|
@ -34,13 +55,18 @@ window.Options = {};
|
||||||
|
|
||||||
var ctaAlpha = 1;
|
var ctaAlpha = 1;
|
||||||
var click_to_advance = $("#click_to_advance");
|
var click_to_advance = $("#click_to_advance");
|
||||||
|
var cta_text1 = $("#cta_text1");
|
||||||
|
var cta_text2 = $("#cta_text2");
|
||||||
click_to_advance.style.display = "none";
|
click_to_advance.style.display = "none";
|
||||||
subscribe("show_click_to_advance", function(){
|
subscribe("show_click_to_advance", function(){
|
||||||
if(HOW_MANY_PROMPTS>0){
|
|
||||||
click_to_advance.style.display = "block";
|
cta_text1.style.display = (HOW_MANY_PROMPTS>0) ? "inline" : "none";
|
||||||
blinkCTA();
|
cta_text2.style.display = (HOW_MANY_PROMPTS>0) ? "none" : "inline";
|
||||||
HOW_MANY_PROMPTS--;
|
HOW_MANY_PROMPTS--;
|
||||||
}
|
|
||||||
|
click_to_advance.style.display = "block";
|
||||||
|
blinkCTA();
|
||||||
|
|
||||||
});
|
});
|
||||||
subscribe("hide_click_to_advance", function(){
|
subscribe("hide_click_to_advance", function(){
|
||||||
click_to_advance.style.display = "none";
|
click_to_advance.style.display = "none";
|
||||||
|
@ -70,6 +96,11 @@ window.Options = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also, move click_to_advance DOM
|
||||||
|
var wordsTop = parseInt($("#game_words").style.top);
|
||||||
|
var wordsHeight = $("#game_words").getBoundingClientRect().height;
|
||||||
|
click_to_advance.style.top = Math.round(wordsTop+wordsHeight+5) + "px";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var _timeoutCallbacks = [];
|
var _timeoutCallbacks = [];
|
||||||
|
@ -90,9 +121,13 @@ window.Options = {};
|
||||||
// Calculate text speed...
|
// Calculate text speed...
|
||||||
var t = parseFloat(text_speed_slider.value);
|
var t = parseFloat(text_speed_slider.value);
|
||||||
t = (1-t); // whoops, flip around
|
t = (1-t); // whoops, flip around
|
||||||
// Log slider, from 30 to 120, with 50 "in the middle"
|
// Log slider, from 5 to 120, with 50 "in the middle"
|
||||||
// f(0)=20, f(0.5)=50(+30), f(1)=120(+100)
|
// f(0)=5, f(0.5)=50, f(1)=120
|
||||||
var speed = Math.round( 20 + Math.exp(t*2.5)*9 ); // close enough
|
// a*e^(0.0*b) + c = 5
|
||||||
|
// a*e^(0.5*b) + c = 50
|
||||||
|
// a*e^(1.0*b) + c = 120
|
||||||
|
// constants gotten by Wolfram Alpha, thanks Wolfy.
|
||||||
|
var speed = Math.round( 81*Math.exp(t*0.885) - 76 );
|
||||||
Game.TEXT_SPEED = speed;
|
Game.TEXT_SPEED = speed;
|
||||||
|
|
||||||
// Clear previous crap
|
// Clear previous crap
|
||||||
|
@ -141,6 +176,8 @@ window.Options = {};
|
||||||
_clearAllTimeouts();
|
_clearAllTimeouts();
|
||||||
text_speed_preview.innerHTML = "";
|
text_speed_preview.innerHTML = "";
|
||||||
|
|
||||||
|
sfx("ui_show_choice", {volume:0.4});
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
updateText();
|
updateText();
|
||||||
},400);
|
},400);
|
||||||
|
@ -149,12 +186,15 @@ window.Options = {};
|
||||||
|
|
||||||
var ALREADY_DID_INTRO = false;
|
var ALREADY_DID_INTRO = false;
|
||||||
$("#options_ok").onclick = function(){
|
$("#options_ok").onclick = function(){
|
||||||
|
|
||||||
if(!ALREADY_DID_INTRO){
|
if(!ALREADY_DID_INTRO){
|
||||||
|
sfx("ui_click");
|
||||||
publish("cut_options_bottom");
|
publish("cut_options_bottom");
|
||||||
ALREADY_DID_INTRO = true;
|
ALREADY_DID_INTRO = true;
|
||||||
}else{
|
}else{
|
||||||
publish("hide_options");
|
publish("hide_options");
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
subscribe("cut_options_bottom", function(){
|
subscribe("cut_options_bottom", function(){
|
||||||
|
@ -181,7 +221,8 @@ window.Options = {};
|
||||||
Howler.mute(false); // hack
|
Howler.mute(false); // hack
|
||||||
});
|
});
|
||||||
|
|
||||||
subscribe("hide_options", function(){
|
subscribe("hide_options", function(){
|
||||||
|
sfx("ui_click");
|
||||||
optionsDOM.style.top = "";
|
optionsDOM.style.top = "";
|
||||||
Options.showing = false;
|
Options.showing = false;
|
||||||
Game.onUnpause();
|
Game.onUnpause();
|
||||||
|
|
|
@ -2,7 +2,8 @@ Loader.addSounds([
|
||||||
{ id:"voice_hong", src:"sounds/voices/hong.mp3" },
|
{ id:"voice_hong", src:"sounds/voices/hong.mp3" },
|
||||||
{ id:"voice_beebee", src:"sounds/voices/beebee.mp3" },
|
{ id:"voice_beebee", src:"sounds/voices/beebee.mp3" },
|
||||||
{ id:"voice_narrator", src:"sounds/voices/narrator.mp3" },
|
{ id:"voice_narrator", src:"sounds/voices/narrator.mp3" },
|
||||||
{ id:"voice_narrator_emphasis", src:"sounds/voices/narrator_emphasis.mp3" }
|
{ id:"voice_narrator_emphasis", src:"sounds/voices/narrator_emphasis.mp3" },
|
||||||
|
{ id:"voice_typewriter", src:"sounds/voices/typewriter.mp3" }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
window.sfx = function(sound, options){
|
window.sfx = function(sound, options){
|
||||||
|
@ -24,9 +25,23 @@ window.stopAllSounds = function(){
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window._lastPlayedVoice = {};
|
||||||
window.voice = function(name, options){
|
window.voice = function(name, options){
|
||||||
|
|
||||||
|
// How long since voice last played?
|
||||||
|
name = "voice_"+name;
|
||||||
|
window._lastPlayedVoice[name] = window._lastPlayedVoice[name] || 0;
|
||||||
|
var now = (new Date()).getTime();
|
||||||
|
var delta = now - window._lastPlayedVoice[name];
|
||||||
|
|
||||||
|
// If too soon, DON'T PLAY.
|
||||||
|
if(delta < 4/60*1000) return; // 4 frames
|
||||||
|
|
||||||
|
// Otherwise, play
|
||||||
options = options || {};
|
options = options || {};
|
||||||
sfx("voice_"+name, options);
|
sfx(name, options);
|
||||||
|
window._lastPlayedVoice[name] = now;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.CURRENT_MUSIC = null;
|
window.CURRENT_MUSIC = null;
|
||||||
|
|
|
@ -104,7 +104,7 @@ function BG_Intro(){
|
||||||
20
|
20
|
||||||
]
|
]
|
||||||
|
|
||||||
var ticker = 0; //18;//0;
|
var ticker = 18;//0;
|
||||||
var frameTicker = ticker;
|
var frameTicker = ticker;
|
||||||
var parallaxTicker = 0;
|
var parallaxTicker = 0;
|
||||||
var SHOWN_PLAY_BUTTON = false;
|
var SHOWN_PLAY_BUTTON = false;
|
||||||
|
|
|
@ -21,7 +21,7 @@ subscribe("START_GAME", function(){
|
||||||
$("#loading").style.display = "none";
|
$("#loading").style.display = "none";
|
||||||
Game.start();
|
Game.start();
|
||||||
|
|
||||||
/*SceneSetup.act1();
|
SceneSetup.act1();
|
||||||
//music('battle', {volume:0.5});
|
//music('battle', {volume:0.5});
|
||||||
hong({body:"phone1"});
|
hong({body:"phone1"});
|
||||||
publish("hp_show");
|
publish("hp_show");
|
||||||
|
@ -30,8 +30,8 @@ subscribe("START_GAME", function(){
|
||||||
_.hookuphole = true;
|
_.hookuphole = true;
|
||||||
_.catmilk = true;
|
_.catmilk = true;
|
||||||
|
|
||||||
Game.goto("act1i");*/
|
Game.goto("act1i");
|
||||||
|
|
||||||
Game.goto("intro");
|
//Game.goto("intro");
|
||||||
|
|
||||||
});
|
});
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -13,7 +13,7 @@ MAIN GAME
|
||||||
|
|
||||||
******************************************************************************************************/
|
******************************************************************************************************/
|
||||||
|
|
||||||
#game_words, #game_choices, #paused, #options, #loading, #gear, #about{
|
#game_words, #game_choices, #paused, #options, #loading, #gear, #about, #click_to_advance{
|
||||||
-webkit-user-select: none; /* Safari 3.1+ */
|
-webkit-user-select: none; /* Safari 3.1+ */
|
||||||
-moz-user-select: none; /* Firefox 2+ */
|
-moz-user-select: none; /* Firefox 2+ */
|
||||||
-ms-user-select: none; /* IE 10+ */
|
-ms-user-select: none; /* IE 10+ */
|
||||||
|
@ -45,7 +45,7 @@ MAIN GAME
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#game_words, #game_hp{
|
#game_words, #game_hp, #click_to_advance{
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue