SOUNDS
This commit is contained in:
parent
436f3fd5f1
commit
d2b5590477
22
TODOS
22
TODOS
|
@ -1,8 +1,24 @@
|
|||
|
||||
- Why's there a long pause between scene transitions?
|
||||
- Why's there a long pause between scene transitions? // or is there with devtools OFF?
|
||||
|
||||
- black out, then show END SCREEN (for newsletter, patreon, in meantime my other games)
|
||||
|
||||
- icons in the start
|
||||
- if can contain code with { } regex
|
||||
|
||||
- hp white out
|
||||
|
||||
- drag through street for points
|
||||
|
||||
- less long . . . post-Tinder
|
||||
|
||||
- wait before hey human
|
||||
|
||||
- shaking logo (& w/ outline)
|
||||
|
||||
- if allows whitespace inside (space, but NOT newline)
|
||||
|
||||
- not Warren but textbook (which you don't read)
|
||||
|
||||
THANKS:
|
||||
- Caeser js
|
||||
|
||||
- if can contain code with { } regex
|
|
@ -27,6 +27,7 @@
|
|||
<script src="scripts/lib/helpers.js"></script>
|
||||
<script src="scripts/lib/rsvp.min.js"></script>
|
||||
<script src="scripts/lib/minpubsub.min.js"></script>
|
||||
<script src="scripts/lib/howler.min.js"></script>
|
||||
|
||||
<script src="scripts/game/Game.js"></script>
|
||||
<script src="scripts/game/Loader.js"></script>
|
||||
|
@ -34,6 +35,7 @@
|
|||
<script src="scripts/game/HP.js"></script>
|
||||
<script src="scripts/game/BG_Anxiety.js"></script>
|
||||
<script src="scripts/game/Character.js"></script>
|
||||
<script src="scripts/game/Sounds.js"></script>
|
||||
|
||||
<script src="scripts/intro/Intro_SceneSetup.js"></script>
|
||||
<script src="scripts/intro/Intro_BG.js"></script>
|
||||
|
|
|
@ -164,7 +164,7 @@ n: FEAR OF *BEING UNLOVED* #alone#
|
|||
|
||||
n: AND FEAR OF *BEING A BAD PERSON* #bad#
|
||||
|
||||
n: (PRO TIP: TRY PLAYING THE CHOICES THAT MOST HIT YOUR DEEPEST, DARKEST FEARS!)
|
||||
n: (PRO TIP: TRY PLAYING THE CHOICES THAT MOST HIT YOUR DEEPEST DARKEST FEARS!)
|
||||
|
||||
h: ...
|
||||
|
||||
|
@ -193,6 +193,8 @@ n: GOOD LUCK
|
|||
|
||||
# act1c
|
||||
|
||||
`music('battle', 0.5)`
|
||||
|
||||
n: ROUND ONE: *FIGHT!*
|
||||
|
||||
`bb({body:"normal", mouth:"normal", eyes:"normal"});`
|
||||
|
@ -1043,7 +1045,8 @@ attack("30p", "harm");
|
|||
```
|
||||
bb({body:"normal", mouth:"normal", eyes:"look"});
|
||||
hong({body:"2_tired"});
|
||||
Game.OVERRIDE_TEXT_SPEED = 0.25;
|
||||
Game.OVERRIDE_TEXT_SPEED = 0.5;
|
||||
music(false);
|
||||
```
|
||||
|
||||
h: ...
|
||||
|
@ -1220,7 +1223,7 @@ b: ..................
|
|||
|
||||
```
|
||||
hong({body:"3_defeated1"});
|
||||
attack("30p", "harm");
|
||||
attack("100p", "harm");
|
||||
```
|
||||
|
||||
(...2500)
|
||||
|
@ -1231,7 +1234,7 @@ attack("30p", "harm");
|
|||
|
||||
```
|
||||
hong({body:"3_defeated1"});
|
||||
attack("30p", "alone");
|
||||
attack("100p", "alone");
|
||||
```
|
||||
|
||||
(...2500)
|
||||
|
@ -1242,7 +1245,7 @@ attack("30p", "alone");
|
|||
|
||||
```
|
||||
hong({body:"3_defeated1"});
|
||||
attack("30p", "bad");
|
||||
attack("100p", "bad");
|
||||
```
|
||||
|
||||
(...2500)
|
||||
|
@ -1251,7 +1254,10 @@ attack("30p", "bad");
|
|||
|
||||
# act1i
|
||||
|
||||
`bb({mouth:"smile_lock", eyes:"smile"});`
|
||||
```
|
||||
bb({mouth:"smile_lock", eyes:"smile"});
|
||||
music('battle', 0.5);
|
||||
```
|
||||
|
||||
n: CONGRATULATIONS
|
||||
|
||||
|
@ -1259,7 +1265,7 @@ n: YOU HAVE SUCCESSFULLY PROTECTED YOUR HUMAN
|
|||
|
||||
n: LOOK HOW GRATEFUL THEY ARE
|
||||
|
||||
n: NOW THAT THEIR ENERGY IS ZERO, YOU CAN DIRECTLY CONTROL THEIR ACTIONS.
|
||||
n: NOW THAT THEIR ENERGY IS ZERO, YOU CAN DIRECTLY CONTROL THEIR ACTIONS!
|
||||
|
||||
`bb({mouth:"smile", eyes:"normal"});`
|
||||
|
||||
|
|
|
@ -17,7 +17,10 @@ SceneSetup.act1 = function(){
|
|||
};
|
||||
SceneSetup.act1_outro = function(){
|
||||
|
||||
HP.hide();
|
||||
clearText();
|
||||
music(false);
|
||||
|
||||
Game.resetScene();
|
||||
|
||||
// Background
|
||||
|
|
|
@ -111,12 +111,14 @@ Game.pausedDOM = $("#paused");
|
|||
Game.pause = function(){
|
||||
Game.paused = true;
|
||||
Game.pausedDOM.style.display = "block";
|
||||
Howler.mute(true);
|
||||
};
|
||||
window.addEventListener("blur", Game.pause);
|
||||
Game.onUnpause = function(){
|
||||
if(Game.paused){
|
||||
Game.paused = false;
|
||||
Game.pausedDOM.style.display = "none";
|
||||
Howler.mute(false);
|
||||
}
|
||||
};
|
||||
window.addEventListener("click", Game.onUnpause);
|
||||
|
@ -320,12 +322,25 @@ Game.executeText = function(line){
|
|||
if(i==dialogue.length-1 && chr=="-") break;
|
||||
|
||||
// for scopin'
|
||||
(function(index, interval){
|
||||
(function(index, interval, speaker){
|
||||
Game.setTimeout(function(){
|
||||
|
||||
// Show it
|
||||
div.children[index].style.opacity = 1;
|
||||
//div.innerHTML += chr;
|
||||
|
||||
// And SOUND?
|
||||
var chr = div.children[index].innerHTML;
|
||||
if(chr!=" "){
|
||||
if(speaker=="h"){
|
||||
voice("hong", 0.3);
|
||||
}
|
||||
if(speaker=="b"){
|
||||
voice("beebee", 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
}, interval);
|
||||
})(i, interval);
|
||||
})(i, interval, speaker);
|
||||
|
||||
// Bigger interval
|
||||
if(i!=dialogue.length-1){ // NOT last
|
||||
|
@ -400,11 +415,19 @@ Game.executeText = function(line){
|
|||
var word = dialogueWords[i];
|
||||
|
||||
// for scopin'
|
||||
(function(index, interval){
|
||||
(function(index, interval, word){
|
||||
Game.setTimeout(function(){
|
||||
|
||||
// Show
|
||||
div.children[index].style.opacity = 1;
|
||||
|
||||
// SOUND
|
||||
var chr = word.slice(-1);
|
||||
var isEmphasis = (chr=="*");
|
||||
voice(isEmphasis ? "narrator_emphasis" : "narrator");
|
||||
|
||||
}, interval);
|
||||
})(i, interval);
|
||||
})(i, interval, word);
|
||||
|
||||
// Interval
|
||||
interval += SPEED*6;
|
||||
|
|
|
@ -2,6 +2,12 @@ Loader.addImages([
|
|||
{ id:"hp", src:"sprites/ui/hp.png" }
|
||||
]);
|
||||
|
||||
Loader.addSounds([
|
||||
{ id:"hit", src:"sounds/sfx/hit.mp3" },
|
||||
{ id:"hit_big", src:"sounds/sfx/hit_big.mp3" }
|
||||
]);
|
||||
|
||||
|
||||
// The Class!
|
||||
function HitPoints(){
|
||||
|
||||
|
@ -71,6 +77,13 @@ function HitPoints(){
|
|||
self.rightShake = 30;
|
||||
}
|
||||
|
||||
// Sound
|
||||
if(damage=="100p"){ // FULL!
|
||||
sfx("hit_big");
|
||||
}else{
|
||||
sfx("hit");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Draw
|
||||
|
@ -98,7 +111,7 @@ function HitPoints(){
|
|||
|
||||
// BLACK
|
||||
var sx=isRight ? 360 : 0, sy=0, sw=360, sh=150;
|
||||
ctx.drawImage(self.image, sx,sy,sw,sh, sx/2,sy/2,sw/2,sh/2); // black
|
||||
ctx.drawImage(self.image, sx,sy,sw,sh, sx/2,sy/2,sw/2,sh/2); // black
|
||||
|
||||
// RED
|
||||
var hpRatio = (hp+32)/(100+32); // 100,0 => 1,0.3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
window.Loader = {};
|
||||
window.Library = {
|
||||
images: {}
|
||||
images: {},
|
||||
sounds: {}
|
||||
};
|
||||
Loader.load = function(){
|
||||
return new RSVP.Promise(function(resolve){
|
||||
|
@ -17,6 +18,11 @@ Loader.load = function(){
|
|||
loadPromises.push( Loader.loadImage(config) );
|
||||
});
|
||||
|
||||
// All sounds
|
||||
Loader.soundConfigs.forEach(function(config){
|
||||
loadPromises.push( Loader.loadSound(config) );
|
||||
});
|
||||
|
||||
// Go go go!
|
||||
RSVP.all(loadPromises).then(resolve);
|
||||
|
||||
|
@ -62,3 +68,24 @@ Loader.loadScene = function(src){
|
|||
xhr.send();
|
||||
});
|
||||
};
|
||||
|
||||
/////////////////////////////
|
||||
// SOUNDS ///////////////////
|
||||
/////////////////////////////
|
||||
|
||||
Loader.soundConfigs = [];
|
||||
Loader.addSounds = function(soundConfigs){
|
||||
Loader.soundConfigs = Loader.soundConfigs.concat(soundConfigs);
|
||||
};
|
||||
Loader.loadSound = function(soundConfig){
|
||||
return new RSVP.Promise(function(resolve){
|
||||
var sound = new Howl({
|
||||
src: [soundConfig.src]
|
||||
});
|
||||
var id = soundConfig.id;
|
||||
Library.sounds[id] = sound; // ADD TO LIBRARY
|
||||
sound.once("load",function(){
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
Loader.addSounds([
|
||||
{ id:"music_battle", src:"sounds/music/battle.mp3" }
|
||||
]);
|
||||
|
||||
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" }
|
||||
]);
|
||||
|
||||
window.sfx = function(sound, volume, pan){
|
||||
|
||||
volume = volume===undefined ? 1 : volume;
|
||||
pan = pan===undefined ? 0 : pan;
|
||||
|
||||
var sfx = Library.sounds[sound];
|
||||
sfx.volume(volume);
|
||||
sfx.stereo(pan);
|
||||
sfx.play();
|
||||
|
||||
};
|
||||
|
||||
window.voice = function(name, volume, pan){
|
||||
sfx("voice_"+name, volume, pan);
|
||||
}
|
||||
|
||||
window.CURRENT_MUSIC = null;
|
||||
window.music = function(song, volume){
|
||||
|
||||
if(!song){
|
||||
|
||||
window.CURRENT_MUSIC.stop();
|
||||
window.CURRENT_MUSIC = null;
|
||||
|
||||
}else{
|
||||
|
||||
var song = Library.sounds["music_"+song];
|
||||
song.volume(volume);
|
||||
song.loop(true);
|
||||
song.play();
|
||||
window.CURRENT_MUSIC = song;
|
||||
|
||||
}
|
||||
|
||||
};
|
|
@ -100,6 +100,10 @@ function BG_Intro(){
|
|||
// TICKER
|
||||
ticker += 1/60;
|
||||
|
||||
/*if(Math.random()<0.01){
|
||||
Library.sounds.test.play();
|
||||
}*/
|
||||
|
||||
// CLOUD OFFSET
|
||||
OFFSETS[1] = -80 + ticker*3;
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,25 +1,24 @@
|
|||
// Load assets
|
||||
Loader.addScenes([
|
||||
"scenes/intro.md",
|
||||
"scenes/act1.md",
|
||||
//"scenes/test.md",
|
||||
//"scenes/test-outro.md"
|
||||
"scenes/act1.md"
|
||||
]);
|
||||
Loader.load().then(function(){
|
||||
|
||||
Game.init();
|
||||
Game.start();
|
||||
|
||||
Game.pause(); // just for sounds
|
||||
|
||||
// Set up...
|
||||
/*SceneSetup.act1();
|
||||
publish("hp_show");
|
||||
hong({body:"phone1", mouth:"neutral", eyes:"neutral"});
|
||||
//_.whitebread = true;
|
||||
_.partyinvite="ignore";
|
||||
_.fifteencigs = true;
|
||||
//_.subtweet=true;
|
||||
_.seppuku = true;*/
|
||||
|
||||
_.whitebread = true;*/
|
||||
|
||||
// GO!
|
||||
Game.goto("act1");
|
||||
//music('battle', 0.5);
|
||||
//Game.goto("act1f");
|
||||
Game.goto("intro");
|
||||
|
||||
});
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue