A HECK A LOT OF SOUNDS
This commit is contained in:
parent
ff8275efc5
commit
2ae02af102
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.
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.
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.
|
@ -110,6 +110,12 @@ b, strong{
|
||||||
line-height: 25px;
|
line-height: 25px;
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
}
|
}
|
||||||
#container > #skip:hover{
|
#container > #skip:hover{
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
|
|
|
@ -371,6 +371,7 @@ MY "WHY" FOR MAKING THIS:
|
||||||
<br>
|
<br>
|
||||||
Draw a network & run the simulation,
|
Draw a network & run the simulation,
|
||||||
so that <i>everyone</i> gets infected with the "contagion".
|
so that <i>everyone</i> gets infected with the "contagion".
|
||||||
|
<br>
|
||||||
(new rule: you can't cut the <i>thick</i> connections)
|
(new rule: you can't cut the <i>thick</i> connections)
|
||||||
</words>
|
</words>
|
||||||
|
|
||||||
|
@ -403,8 +404,11 @@ MY "WHY" FOR MAKING THIS:
|
||||||
|
|
||||||
Now, let's simulate what happens if people <i>do</i> start drinking
|
Now, let's simulate what happens if people <i>do</i> start drinking
|
||||||
<i>when 50%+ of their friends do!</i>
|
<i>when 50%+ of their friends do!</i>
|
||||||
<b>Before you start the sim, ask yourself what you think <i>should</i> happen.
|
<b>Before you start the sim, ask yourself what you think <i>should</i> happen.</b>
|
||||||
Now, run the sim, and see what actually happens! →</b>
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<b>Now, run the sim, and see what actually happens! →</b>
|
||||||
|
|
||||||
</words>
|
</words>
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ SLIDES.push(
|
||||||
// START, FOR REAL
|
// START, FOR REAL
|
||||||
button.onclick = function(){
|
button.onclick = function(){
|
||||||
publish("START");
|
publish("START");
|
||||||
|
publish("sound/button");
|
||||||
};
|
};
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,19 +32,19 @@ SLIDES.push(
|
||||||
{
|
{
|
||||||
type:"box",
|
type:"box",
|
||||||
id:"connect_words",
|
id:"connect_words",
|
||||||
text:"networks_tutorial_connect", x:280, y:183, w:400, align:"center", color:"#ccc"
|
text:"networks_tutorial_connect", x:280, y:183-7, w:400, align:"center", color:"#bbb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type:"box",
|
type:"box",
|
||||||
id:"connect_pic",
|
id:"connect_pic",
|
||||||
img:"sprites/tutorial_connect.png", x:330, y:150, w:300, h:100
|
img:"sprites/tutorial_connect.png", x:330, y:150-7, w:300, h:100
|
||||||
},
|
},
|
||||||
|
|
||||||
// "Disconnect" instruction (words & picture)
|
// "Disconnect" instruction (words & picture)
|
||||||
{
|
{
|
||||||
type:"box",
|
type:"box",
|
||||||
id:"disconnect_words",
|
id:"disconnect_words",
|
||||||
text:"networks_tutorial_disconnect", x:280, y:280, w:400, align:"center", color:"#ccc"
|
text:"networks_tutorial_disconnect", x:280, y:280, w:400, align:"center", color:"#bbb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type:"box",
|
type:"box",
|
||||||
|
|
|
@ -171,7 +171,10 @@ SLIDES.push(
|
||||||
var boxes = slideshow.boxes;
|
var boxes = slideshow.boxes;
|
||||||
boxes.showChildByID("end", true);
|
boxes.showChildByID("end", true);
|
||||||
state.ended = true;
|
state.ended = true;
|
||||||
sim.win();
|
sim.win({
|
||||||
|
small:true,
|
||||||
|
x:280, y:200, width:400, height:200
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,9 @@ SLIDES.push(
|
||||||
boxes.removeChildByID("complex_complex_3", true);
|
boxes.removeChildByID("complex_complex_3", true);
|
||||||
boxes.showChildByID("end", true);
|
boxes.showChildByID("end", true);
|
||||||
state.ended = true;
|
state.ended = true;
|
||||||
sim.win();
|
sim.win({
|
||||||
|
small:true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +328,8 @@ SLIDES.push(
|
||||||
//boxes.showChildByID("end", true);
|
//boxes.showChildByID("end", true);
|
||||||
sim.win({
|
sim.win({
|
||||||
x:350, y:270-90,
|
x:350, y:270-90,
|
||||||
width:260, height:260
|
width:260, height:260,
|
||||||
|
small:true
|
||||||
});
|
});
|
||||||
},350);
|
},350);
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
|
|
@ -24,7 +24,8 @@ SLIDES.push(
|
||||||
options:{
|
options:{
|
||||||
infectedFrame: 3,
|
infectedFrame: 3,
|
||||||
scale: 1,
|
scale: 1,
|
||||||
_wisdom: true
|
_wisdom: true,
|
||||||
|
NO_BONK: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -81,7 +82,8 @@ SLIDES.push(
|
||||||
state.ended = true;
|
state.ended = true;
|
||||||
sim.win({
|
sim.win({
|
||||||
x:330+5, y:160-120+5,
|
x:330+5, y:160-120+5,
|
||||||
width:280, height:280
|
width:280, height:280,
|
||||||
|
small:true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,10 @@ SLIDES.push(
|
||||||
{type:"box", id:"conclusion_3"}
|
{type:"box", id:"conclusion_3"}
|
||||||
],
|
],
|
||||||
onstart: function(slideshow, state){
|
onstart: function(slideshow, state){
|
||||||
|
|
||||||
|
// SOUND
|
||||||
|
SOUNDS.chimes.play();
|
||||||
|
|
||||||
// splash animation, then auto-next to CREDITS.
|
// splash animation, then auto-next to CREDITS.
|
||||||
var splash = slideshow.simulations.sims[0];
|
var splash = slideshow.simulations.sims[0];
|
||||||
splash.options.CONCLUSION = true;
|
splash.options.CONCLUSION = true;
|
||||||
|
@ -95,6 +99,7 @@ SLIDES.push(
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
slideshow.next();
|
slideshow.next();
|
||||||
},7000);
|
},7000);
|
||||||
|
|
||||||
},
|
},
|
||||||
onupdate: function(slideshow, state){
|
onupdate: function(slideshow, state){
|
||||||
var splash = slideshow.simulations.sims[0];
|
var splash = slideshow.simulations.sims[0];
|
||||||
|
|
|
@ -46,6 +46,7 @@ subscribe("START", function(){
|
||||||
// Show Skip Button
|
// Show Skip Button
|
||||||
$("#skip").style.display = "block";
|
$("#skip").style.display = "block";
|
||||||
$("#skip").onclick = function(){
|
$("#skip").onclick = function(){
|
||||||
|
publish("sound/button");
|
||||||
slideshow.next();
|
slideshow.next();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,19 @@ function Connection(config){
|
||||||
var dy = self.to.y - self.from.y;
|
var dy = self.to.y - self.from.y;
|
||||||
var a = Math.atan2(dy,dx);
|
var a = Math.atan2(dy,dx);
|
||||||
var dist = Math.sqrt(dx*dx + dy*dy);
|
var dist = Math.sqrt(dx*dx + dy*dy);
|
||||||
|
ctx.rotate(a);
|
||||||
|
|
||||||
|
// SHAKE
|
||||||
|
if(self.shaking>=0 && self.shaking<1){
|
||||||
|
self.shaking+=0.05;
|
||||||
|
var amplitude = (1-self.shaking)*3;
|
||||||
|
ctx.translate(0, Math.sin(self.shaking*Math.TAU*3)*amplitude);
|
||||||
|
}
|
||||||
|
|
||||||
self.sprite.scaleX = dist/300;
|
self.sprite.scaleX = dist/300;
|
||||||
self.sprite.scaleY = self.uncuttable ? 1 : 0.5; // thick=uncuttable
|
self.sprite.scaleY = self.uncuttable ? 1 : 0.5; // thick=uncuttable
|
||||||
//self.sprite.scaleY *= s;
|
//self.sprite.scaleY *= s;
|
||||||
self.sprite.rotation = a;
|
//self.sprite.rotation = a;
|
||||||
self.sprite.draw(ctx);
|
self.sprite.draw(ctx);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
|
|
||||||
|
@ -117,5 +126,9 @@ function Connection(config){
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
self.shaking = -1;
|
||||||
|
self.shake = function(){
|
||||||
|
self.shaking = 0;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
|
@ -10,6 +10,21 @@ function ConnectorCutter(config){
|
||||||
self.isCutting = false;
|
self.isCutting = false;
|
||||||
self.cutTrail = [];
|
self.cutTrail = [];
|
||||||
|
|
||||||
|
// SNIP & PLUCK SOUND
|
||||||
|
var _SNIP_SOUND = 0;
|
||||||
|
var _SNIP = function(){
|
||||||
|
_SNIP_SOUND = (_SNIP_SOUND+1)%3;
|
||||||
|
SOUNDS["snip"+_SNIP_SOUND].play();
|
||||||
|
};
|
||||||
|
var _PLUCK_SOUND_INDEX = 0;
|
||||||
|
var _PLUCK_SOUND = [0,1,2,3,2,1];
|
||||||
|
var _PLUCK = function(){
|
||||||
|
var soundName = "pluck"+_PLUCK_SOUND[_PLUCK_SOUND_INDEX];
|
||||||
|
SOUNDS[soundName].play();
|
||||||
|
_PLUCK_SOUND_INDEX++;
|
||||||
|
if(_PLUCK_SOUND_INDEX >= _PLUCK_SOUND.length) _PLUCK_SOUND_INDEX=0;
|
||||||
|
};
|
||||||
|
|
||||||
// Update!
|
// Update!
|
||||||
self.state = 0; // 0-nothing | 1-connecting | 2-cutting
|
self.state = 0; // 0-nothing | 1-connecting | 2-cutting
|
||||||
self.sandbox_state = 0; // 0-pencil | 1-add_peep | 2-add_infected | 3-move | 4-delete | 5-bomb
|
self.sandbox_state = 0; // 0-pencil | 1-add_peep | 2-add_infected | 3-move | 4-delete | 5-bomb
|
||||||
|
@ -44,8 +59,14 @@ function ConnectorCutter(config){
|
||||||
// Clicked on a peep?
|
// Clicked on a peep?
|
||||||
var peepClicked = self.sim.getHoveredPeep(20);
|
var peepClicked = self.sim.getHoveredPeep(20);
|
||||||
if(peepClicked){
|
if(peepClicked){
|
||||||
|
|
||||||
self.state = 1; // START CONNECTING
|
self.state = 1; // START CONNECTING
|
||||||
self.connectFrom = peepClicked;
|
self.connectFrom = peepClicked;
|
||||||
|
|
||||||
|
// SOUND!
|
||||||
|
SOUNDS.pencil_short.volume(0.37);
|
||||||
|
SOUNDS.pencil_short.play();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
self.state = 2; // START ERASING
|
self.state = 2; // START ERASING
|
||||||
}
|
}
|
||||||
|
@ -59,7 +80,14 @@ function ConnectorCutter(config){
|
||||||
if(self.state==1){
|
if(self.state==1){
|
||||||
var peepReleased = self.sim.getHoveredPeep(20);
|
var peepReleased = self.sim.getHoveredPeep(20);
|
||||||
if(peepReleased){
|
if(peepReleased){
|
||||||
self.sim.addConnection(self.connectFrom, peepReleased);
|
var successfulConnection = self.sim.addConnection(self.connectFrom, peepReleased);
|
||||||
|
|
||||||
|
// SOUND!
|
||||||
|
if(successfulConnection){
|
||||||
|
SOUNDS.pencil.volume(0.37);
|
||||||
|
SOUNDS.pencil.play();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +128,13 @@ function ConnectorCutter(config){
|
||||||
|
|
||||||
// Try cutting
|
// Try cutting
|
||||||
var line = [mouse.lastX, mouse.lastY, mouse.x, mouse.y];
|
var line = [mouse.lastX, mouse.lastY, mouse.x, mouse.y];
|
||||||
self.sim.tryCuttingConnections(line);
|
var wasLineCut = self.sim.tryCuttingConnections(line);
|
||||||
|
if(wasLineCut==1){ // snip!
|
||||||
|
_SNIP();
|
||||||
|
}
|
||||||
|
if(wasLineCut==-1){ // uncuttable
|
||||||
|
_PLUCK();
|
||||||
|
}
|
||||||
|
|
||||||
// Add to trail
|
// Add to trail
|
||||||
self.cutTrail.unshift([mouse.x,mouse.y]); // add to start
|
self.cutTrail.unshift([mouse.x,mouse.y]); // add to start
|
||||||
|
|
|
@ -119,6 +119,13 @@ function Sim(config){
|
||||||
|
|
||||||
self.id = config.id;
|
self.id = config.id;
|
||||||
|
|
||||||
|
// CONTAGION SOUND
|
||||||
|
var _CONTAGION_SOUND = 0;
|
||||||
|
var _PLAY_CONTAGION_SOUND = function(){
|
||||||
|
_CONTAGION_SOUND = (_CONTAGION_SOUND+1)%3;
|
||||||
|
SOUNDS["contagion"+_CONTAGION_SOUND].play();
|
||||||
|
};
|
||||||
|
|
||||||
// Canvas
|
// Canvas
|
||||||
if(config.fullscreen){
|
if(config.fullscreen){
|
||||||
var container = $("#simulations_container");
|
var container = $("#simulations_container");
|
||||||
|
@ -343,10 +350,23 @@ function Sim(config){
|
||||||
if(self.wonBefore) return;
|
if(self.wonBefore) return;
|
||||||
self.wonBefore = true;
|
self.wonBefore = true;
|
||||||
|
|
||||||
|
// SOUND!
|
||||||
|
if(bounds && bounds.small){
|
||||||
|
SOUNDS.party_short.play();
|
||||||
|
}else{
|
||||||
|
SOUNDS.party.play();
|
||||||
|
}
|
||||||
|
|
||||||
|
// AMOUNT OF CONFETTI
|
||||||
|
var AMOUNT_OF_CONFETTI = 100;
|
||||||
|
if(bounds && bounds.small){
|
||||||
|
AMOUNT_OF_CONFETTI = 50;
|
||||||
|
}
|
||||||
|
|
||||||
// Get center of peeps
|
// Get center of peeps
|
||||||
var fullscreenOffsetX = config.x + simOffset.x;
|
var fullscreenOffsetX = config.x + simOffset.x;
|
||||||
var fullscreenOffsetY = config.y + simOffset.y;
|
var fullscreenOffsetY = config.y + simOffset.y;
|
||||||
bounds = bounds || getBoundsOfPoints(self.peeps); // OPTIONAL BOUNDS
|
if(!bounds || !bounds.x) bounds = getBoundsOfPoints(self.peeps); // OPTIONAL BOUNDS
|
||||||
var cx = bounds.x + bounds.width/2;
|
var cx = bounds.x + bounds.width/2;
|
||||||
var cy = bounds.y + bounds.height/2;
|
var cy = bounds.y + bounds.height/2;
|
||||||
cx += fullscreenOffsetX;
|
cx += fullscreenOffsetX;
|
||||||
|
@ -360,7 +380,7 @@ function Sim(config){
|
||||||
self.winWord.ticker = 0;
|
self.winWord.ticker = 0;
|
||||||
|
|
||||||
// Place confetti
|
// Place confetti
|
||||||
for(var i=0; i<100; i++){
|
for(var i=0; i<AMOUNT_OF_CONFETTI; i++){
|
||||||
var angle = Math.random()*Math.TAU;
|
var angle = Math.random()*Math.TAU;
|
||||||
var burst = bounds.width/15;
|
var burst = bounds.width/15;
|
||||||
var frame = Math.floor(Math.random()*5);
|
var frame = Math.floor(Math.random()*5);
|
||||||
|
@ -392,15 +412,38 @@ function Sim(config){
|
||||||
self.networkConfig = self.getCurrentNetwork();
|
self.networkConfig = self.getCurrentNetwork();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self._canPlayBonkSound = true;
|
||||||
|
|
||||||
self.reload = function(){
|
self.reload = function(){
|
||||||
var contagionLevel = self.contagion; // hack for sandbox: keep contagion the same
|
var contagionLevel = self.contagion; // hack for sandbox: keep contagion the same
|
||||||
self.STEP = 0;
|
self.STEP = 0;
|
||||||
|
self._canPlayBonkSound = true;
|
||||||
self.init();
|
self.init();
|
||||||
self.contagion = contagionLevel;
|
self.contagion = contagionLevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.nextStep = function(){
|
self.nextStep = function(){
|
||||||
|
|
||||||
|
// SOUND! If anyone can be infected, play Contagion sound.
|
||||||
|
// Otherwise play Bonk sound ONCE
|
||||||
|
var canBeInfected = self.peeps.filter(function(peep){
|
||||||
|
return !peep.infected && peep.isPastThreshold;
|
||||||
|
}).length;
|
||||||
|
var isEveryoneInfected = true;
|
||||||
|
self.peeps.forEach(function(peep){
|
||||||
|
if(!peep.infected) isEveryoneInfected=false;
|
||||||
|
});
|
||||||
|
if(canBeInfected>0){
|
||||||
|
_PLAY_CONTAGION_SOUND();
|
||||||
|
}else if(self._canPlayBonkSound && !isEveryoneInfected){
|
||||||
|
self._canPlayBonkSound = false;
|
||||||
|
|
||||||
|
if(!config.options.NO_BONK){
|
||||||
|
SOUNDS.bonk.play();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// "Infect" the peeps who need to get infected
|
// "Infect" the peeps who need to get infected
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
self.STEP++;
|
self.STEP++;
|
||||||
|
@ -565,11 +608,20 @@ function Sim(config){
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
self.tryCuttingConnections = function(line){
|
self.tryCuttingConnections = function(line){
|
||||||
|
var wasLineCut = 0;
|
||||||
for(var i=self.connections.length-1; i>=0; i--){ // going BACKWARDS coz killing connections
|
for(var i=self.connections.length-1; i>=0; i--){ // going BACKWARDS coz killing connections
|
||||||
var c = self.connections[i];
|
var c = self.connections[i];
|
||||||
if(c.uncuttable) continue; // don't touch the UNCUTTABLES
|
if(c.hitTest(line)){
|
||||||
if(c.hitTest(line)) self.connections.splice(i,1);
|
if(c.uncuttable){ // can't cut uncuttables!
|
||||||
|
wasLineCut = -1;
|
||||||
|
c.shake();
|
||||||
|
}else{
|
||||||
|
wasLineCut = 1;
|
||||||
|
self.connections.splice(i,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return wasLineCut;
|
||||||
};
|
};
|
||||||
self.removeAllConnectedTo = function(peep){
|
self.removeAllConnectedTo = function(peep){
|
||||||
for(var i=self.connections.length-1; i>=0; i--){ // backwards index coz we're deleting
|
for(var i=self.connections.length-1; i>=0; i--){ // backwards index coz we're deleting
|
||||||
|
|
|
@ -83,6 +83,7 @@ function Boxes(){
|
||||||
nextButton.className = "next_button";
|
nextButton.className = "next_button";
|
||||||
nextButton.innerHTML = next.innerHTML;
|
nextButton.innerHTML = next.innerHTML;
|
||||||
nextButton.onclick = function(){
|
nextButton.onclick = function(){
|
||||||
|
publish("sound/button");
|
||||||
slideshow.next();
|
slideshow.next();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -104,6 +105,7 @@ function Boxes(){
|
||||||
ref.onclick = function(){
|
ref.onclick = function(){
|
||||||
var id = ref.id;
|
var id = ref.id;
|
||||||
publish("reference/show",[id]);
|
publish("reference/show",[id]);
|
||||||
|
publish("sound/button");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -113,6 +115,7 @@ function Boxes(){
|
||||||
bon.innerHTML = "(?) "+title;
|
bon.innerHTML = "(?) "+title;
|
||||||
bon.onclick = function(){
|
bon.onclick = function(){
|
||||||
publish("bonus/show", [bon.id]);
|
publish("bonus/show", [bon.id]);
|
||||||
|
publish("sound/button");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -171,4 +174,4 @@ function Boxes(){
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ window.Modal = {
|
||||||
$("#modal").setAttribute("size", large ? "large" : "small");
|
$("#modal").setAttribute("size", large ? "large" : "small");
|
||||||
},
|
},
|
||||||
hide: function(){
|
hide: function(){
|
||||||
|
publish("sound/button");
|
||||||
$("#modal_container").removeAttribute("show");
|
$("#modal_container").removeAttribute("show");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@ function Navigation(){
|
||||||
if(chapter){
|
if(chapter){
|
||||||
(function(nav, chapter){
|
(function(nav, chapter){
|
||||||
nav.onclick = function(){
|
nav.onclick = function(){
|
||||||
|
publish("sound/button");
|
||||||
slideshow.gotoChapter(chapter);
|
slideshow.gotoChapter(chapter);
|
||||||
};
|
};
|
||||||
})(nav, chapter);
|
})(nav, chapter);
|
||||||
|
|
|
@ -3,12 +3,19 @@ subscribe("prepreload", function(){
|
||||||
|
|
||||||
Preload([
|
Preload([
|
||||||
|
|
||||||
// For the Sim
|
// For the Splash
|
||||||
{id:"button_large", image:"sprites/button_large.png"},
|
{id:"button_large", image:"sprites/button_large.png"},
|
||||||
{id:"line", image:"sprites/line.png"},
|
{id:"line", image:"sprites/line.png"},
|
||||||
{id:"peeps", image:"sprites/peeps.png"},
|
{id:"peeps", image:"sprites/peeps.png"},
|
||||||
{id:"pencil", image:"sprites/pencil.png"},
|
{id:"pencil", image:"sprites/pencil.png"},
|
||||||
|
|
||||||
|
// Sound Effects
|
||||||
|
{id:"pencil", audio:"audio/pencil.mp3"},
|
||||||
|
{id:"pencil_short", audio:"audio/pencil_short.mp3"},
|
||||||
|
{id:"snip0", audio:"audio/snip0.mp3"},
|
||||||
|
{id:"snip1", audio:"audio/snip1.mp3"},
|
||||||
|
{id:"snip2", audio:"audio/snip2.mp3"},
|
||||||
|
|
||||||
],function(progress){
|
],function(progress){
|
||||||
console.log("Pre-Preloader: "+progress);
|
console.log("Pre-Preloader: "+progress);
|
||||||
if(progress==1){
|
if(progress==1){
|
||||||
|
@ -16,7 +23,7 @@ subscribe("prepreload", function(){
|
||||||
pre_preloader.parentNode.removeChild(pre_preloader);
|
pre_preloader.parentNode.removeChild(pre_preloader);
|
||||||
|
|
||||||
slideshow.gotoChapter("Preloader");
|
slideshow.gotoChapter("Preloader");
|
||||||
//slideshow.gotoChapter("SmallWorld-Explanation");
|
//slideshow.gotoChapter("Simple-Cascade");
|
||||||
|
|
||||||
publish("preload");
|
publish("preload");
|
||||||
}
|
}
|
||||||
|
@ -33,9 +40,35 @@ subscribe("preload", function(){
|
||||||
// Music
|
// Music
|
||||||
{id:"bg_music", audio:"audio/bg_music.mp3"},
|
{id:"bg_music", audio:"audio/bg_music.mp3"},
|
||||||
|
|
||||||
|
// Sound Effects
|
||||||
|
{id:"bonk", audio:"audio/bonk.mp3"},
|
||||||
|
{id:"button0", audio:"audio/button0.mp3"},
|
||||||
|
{id:"button1", audio:"audio/button1.mp3"},
|
||||||
|
{id:"button2", audio:"audio/button2.mp3"},
|
||||||
|
{id:"chimes", audio:"audio/chimes.mp3"},
|
||||||
|
{id:"contagion0", audio:"audio/contagion0.mp3"},
|
||||||
|
{id:"contagion1", audio:"audio/contagion1.mp3"},
|
||||||
|
{id:"contagion2", audio:"audio/contagion2.mp3"},
|
||||||
|
{id:"party", audio:"audio/party.mp3"},
|
||||||
|
{id:"party_short", audio:"audio/party_short.mp3"},
|
||||||
|
{id:"pluck0", audio:"audio/pluck0.mp3"},
|
||||||
|
{id:"pluck1", audio:"audio/pluck1.mp3"},
|
||||||
|
{id:"pluck2", audio:"audio/pluck2.mp3"},
|
||||||
|
{id:"pluck3", audio:"audio/pluck3.mp3"},
|
||||||
|
{id:"scratch_in", audio:"audio/scratch_in.mp3"},
|
||||||
|
{id:"scratch_out", audio:"audio/scratch_out.mp3"},
|
||||||
|
|
||||||
// For the slides
|
// For the slides
|
||||||
|
{id:"icons/blue", image:"sprites/icons/blue.png"},
|
||||||
|
{id:"icons/gray", image:"sprites/icons/gray.png"},
|
||||||
|
{id:"icons/red", image:"sprites/icons/red.png"},
|
||||||
|
{id:"icons/yellow", image:"sprites/icons/yellow.png"},
|
||||||
|
{id:"confetti", image:"sprites/confetti.png"},
|
||||||
|
{id:"nasa", image:"sprites/nasa.png"},
|
||||||
|
{id:"red_button", image:"sprites/red_button.png"},
|
||||||
{id:"sandbox_tools", image:"sprites/sandbox_tools.png"},
|
{id:"sandbox_tools", image:"sprites/sandbox_tools.png"},
|
||||||
{id:"scratch", image:"sprites/scratch.png"},
|
{id:"scratch", image:"sprites/scratch.png"},
|
||||||
|
{id:"small_world", image:"sprites/small_world.png"},
|
||||||
{id:"tutorial_connect", image:"sprites/tutorial_connect.png"},
|
{id:"tutorial_connect", image:"sprites/tutorial_connect.png"},
|
||||||
{id:"tutorial_disconnect", image:"sprites/tutorial_disconnect.png"},
|
{id:"tutorial_disconnect", image:"sprites/tutorial_disconnect.png"},
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,7 @@ function ChooseOne(config){
|
||||||
|
|
||||||
// On Input
|
// On Input
|
||||||
buttonDOM.onclick = function(){
|
buttonDOM.onclick = function(){
|
||||||
|
publish("sound/button");
|
||||||
self.highlight(buttonDOM); // highlight
|
self.highlight(buttonDOM); // highlight
|
||||||
config.oninput(value); // input
|
config.oninput(value); // input
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,14 +4,26 @@ function Scratch(){
|
||||||
self.dom = $("#scratch");
|
self.dom = $("#scratch");
|
||||||
|
|
||||||
self.scratchIn = function(){
|
self.scratchIn = function(){
|
||||||
|
|
||||||
|
// SOUND!
|
||||||
|
SOUNDS.scratch_in.play();
|
||||||
|
|
||||||
|
// anim
|
||||||
self.startUpdateLoop(false, function(){
|
self.startUpdateLoop(false, function(){
|
||||||
self.dom.style.display = "none";
|
self.dom.style.display = "none";
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.scratchOut = function(){
|
self.scratchOut = function(){
|
||||||
|
|
||||||
|
// SOUND!
|
||||||
|
SOUNDS.scratch_in.play();
|
||||||
|
|
||||||
|
// anim
|
||||||
self.dom.style.display = "block";
|
self.dom.style.display = "block";
|
||||||
self.startUpdateLoop(true);
|
self.startUpdateLoop(true);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.startUpdateLoop = function(out, callback){
|
self.startUpdateLoop = function(out, callback){
|
||||||
|
|
|
@ -15,6 +15,7 @@ function SimUI(container, color){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
};
|
};
|
||||||
startButton.onclick = function(event){
|
startButton.onclick = function(event){
|
||||||
|
publish("sound/button");
|
||||||
if(!Simulations.IS_RUNNING){
|
if(!Simulations.IS_RUNNING){
|
||||||
Simulations.IS_RUNNING = true;
|
Simulations.IS_RUNNING = true;
|
||||||
publish("sim/start");
|
publish("sim/start");
|
||||||
|
|
|
@ -181,3 +181,13 @@ function Slideshow(){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
// BUTTON SOUNDS COZ WHATEVER //
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
var _BUTTON_SOUND = 0;
|
||||||
|
subscribe("sound/button",function(){
|
||||||
|
_BUTTON_SOUND = (_BUTTON_SOUND+1)%3;
|
||||||
|
SOUNDS["button"+_BUTTON_SOUND].play();
|
||||||
|
});
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 7.6 KiB |
Loading…
Reference in New Issue