sound and misc fixes

This commit is contained in:
Nicky Case 2019-05-03 12:13:22 -04:00
parent 3b63db6753
commit c05b905eb4
14 changed files with 91 additions and 24 deletions

View File

@ -17,7 +17,8 @@
<!-- Click to Advance-->
<div id="click_to_advance">
👆click anywhere
<span id="cta_text1">👆click anywhere</span>
<span id="cta_text2">⚪️</span>
</div>
<!-- Bottom Corner Tabs -->

View File

@ -306,11 +306,11 @@ b: or even worse... WHITE BREAD
{{/if}}
{{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 !_.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}}
```
@ -424,7 +424,7 @@ bb({eyes:"pained2"});
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;

View File

@ -4,7 +4,7 @@
# 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

View File

@ -1,5 +1,9 @@
window.About = {};
Loader.addSounds([
{ id:"yelp", src:"sounds/sfx/yelp.mp3" }
]);
(function(){
// Newsletter stuff
@ -27,6 +31,8 @@ window.About = {};
};
$("#close_about").onclick = function(){
sfx("ui_click");
aboutDOM.style.top = "";
//aboutDOM.setAttribute("about","yes");
@ -54,7 +60,8 @@ window.About = {};
// Replay
$("#replay").onclick = function(){
// TODO: UI/SCREAM SOUNDS
// UI/SCREAM SOUNDS
sfx("yelp");
// Cut out
aboutDOM.style.top = "";

View File

@ -148,7 +148,7 @@ Game.setTimeout = function(callback, 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(){
// Is this DURING while someone is talking?
@ -389,6 +389,9 @@ Game.executeText = function(line){
if(speaker=="b"){
voice("beebee", {volume:0.5});
}
if(speaker=="n3"){
voice("typewriter", {volume:0.5});
}
}
}

View File

@ -1,5 +1,10 @@
window.Options = {};
Loader.addSounds([
{ id:"ui_button1", src:"sounds/ui/button1.mp3" },
{ id:"ui_button2", src:"sounds/ui/button2.mp3" }
]);
(function(){
var optionsDOM = $("#options");
@ -22,8 +27,24 @@ window.Options = {};
}
Game.CLICK_TO_ADVANCE = !Game.CLICK_TO_ADVANCE;
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 click_to_advance = $("#click_to_advance");
var cta_text1 = $("#cta_text1");
var cta_text2 = $("#cta_text2");
click_to_advance.style.display = "none";
subscribe("show_click_to_advance", function(){
if(HOW_MANY_PROMPTS>0){
click_to_advance.style.display = "block";
blinkCTA();
HOW_MANY_PROMPTS--;
}
cta_text1.style.display = (HOW_MANY_PROMPTS>0) ? "inline" : "none";
cta_text2.style.display = (HOW_MANY_PROMPTS>0) ? "none" : "inline";
HOW_MANY_PROMPTS--;
click_to_advance.style.display = "block";
blinkCTA();
});
subscribe("hide_click_to_advance", function(){
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 = [];
@ -90,9 +121,13 @@ window.Options = {};
// Calculate text speed...
var t = parseFloat(text_speed_slider.value);
t = (1-t); // whoops, flip around
// Log slider, from 30 to 120, with 50 "in the middle"
// f(0)=20, f(0.5)=50(+30), f(1)=120(+100)
var speed = Math.round( 20 + Math.exp(t*2.5)*9 ); // close enough
// Log slider, from 5 to 120, with 50 "in the middle"
// f(0)=5, f(0.5)=50, f(1)=120
// 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;
// Clear previous crap
@ -141,6 +176,8 @@ window.Options = {};
_clearAllTimeouts();
text_speed_preview.innerHTML = "";
sfx("ui_show_choice", {volume:0.4});
setTimeout(function(){
updateText();
},400);
@ -149,12 +186,15 @@ window.Options = {};
var ALREADY_DID_INTRO = false;
$("#options_ok").onclick = function(){
if(!ALREADY_DID_INTRO){
sfx("ui_click");
publish("cut_options_bottom");
ALREADY_DID_INTRO = true;
}else{
publish("hide_options");
}
};
subscribe("cut_options_bottom", function(){
@ -181,7 +221,8 @@ window.Options = {};
Howler.mute(false); // hack
});
subscribe("hide_options", function(){
subscribe("hide_options", function(){
sfx("ui_click");
optionsDOM.style.top = "";
Options.showing = false;
Game.onUnpause();

View File

@ -2,7 +2,8 @@ Loader.addSounds([
{ id:"voice_hong", src:"sounds/voices/hong.mp3" },
{ id:"voice_beebee", src:"sounds/voices/beebee.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){
@ -24,9 +25,23 @@ window.stopAllSounds = function(){
});
};
window._lastPlayedVoice = {};
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 || {};
sfx("voice_"+name, options);
sfx(name, options);
window._lastPlayedVoice[name] = now;
}
window.CURRENT_MUSIC = null;

View File

@ -104,7 +104,7 @@ function BG_Intro(){
20
]
var ticker = 0; //18;//0;
var ticker = 18;//0;
var frameTicker = ticker;
var parallaxTicker = 0;
var SHOWN_PLAY_BUTTON = false;

View File

@ -21,7 +21,7 @@ subscribe("START_GAME", function(){
$("#loading").style.display = "none";
Game.start();
/*SceneSetup.act1();
SceneSetup.act1();
//music('battle', {volume:0.5});
hong({body:"phone1"});
publish("hp_show");
@ -30,8 +30,8 @@ subscribe("START_GAME", function(){
_.hookuphole = true;
_.catmilk = true;
Game.goto("act1i");*/
Game.goto("act1i");
Game.goto("intro");
//Game.goto("intro");
});

BIN
sounds/sfx/yelp.mp3 Normal file

Binary file not shown.

BIN
sounds/ui/button1.mp3 Normal file

Binary file not shown.

BIN
sounds/ui/button2.mp3 Normal file

Binary file not shown.

Binary file not shown.

View File

@ -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+ */
-moz-user-select: none; /* Firefox 2+ */
-ms-user-select: none; /* IE 10+ */
@ -45,7 +45,7 @@ MAIN GAME
overflow: hidden;
}
#game_words, #game_hp{
#game_words, #game_hp, #click_to_advance{
pointer-events: none;
}