Skip to content

Commit

Permalink
Ultimo merge?
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Rodríguez Blázquez committed Jan 31, 2016
2 parents f82b521 + 0540a21 commit da02db4
Show file tree
Hide file tree
Showing 29 changed files with 115 additions and 22 deletions.
Binary file added src/assets/audio/alarma1.ogg
Binary file not shown.
Binary file added src/assets/audio/bien1.ogg
Binary file not shown.
Binary file added src/assets/audio/bien2.ogg
Binary file not shown.
Binary file added src/assets/audio/kraken1.ogg
Binary file not shown.
Binary file added src/assets/audio/kraken2.ogg
Binary file not shown.
Binary file added src/assets/audio/kraken3.ogg
Binary file not shown.
Binary file added src/assets/audio/lampara1.ogg
Binary file not shown.
Binary file added src/assets/audio/lampara2.ogg
Binary file not shown.
Binary file added src/assets/audio/lampara3.ogg
Binary file not shown.
Binary file added src/assets/audio/movil1.ogg
Binary file not shown.
Binary file added src/assets/audio/nervios1.ogg
Binary file not shown.
Binary file added src/assets/audio/nervios2.ogg
Binary file not shown.
Binary file added src/assets/audio/nervios3.ogg
Binary file not shown.
Binary file added src/assets/audio/papel1.ogg
Binary file not shown.
Binary file added src/assets/audio/papel2.ogg
Binary file not shown.
Binary file added src/assets/audio/papel3.ogg
Binary file not shown.
Binary file added src/assets/audio/papel4.ogg
Binary file not shown.
Binary file added src/assets/audio/zumbido.ogg
Binary file not shown.
6 changes: 6 additions & 0 deletions src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
h1{
font-family: 'IndieFlower';
}


html,body{
margin:0;
background: #000;
}
12 changes: 11 additions & 1 deletion src/js/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@
// Load the Google WebFont Loader script
//this.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');

this.load.audio('song1', 'assets/pisong.mp3');
this.load.audio('papel3', 'assets/audio/papel3.ogg');
this.load.audio('alarma1', 'assets/audio/alarma1.ogg');
this.load.audio('movil1', 'assets/audio/movil1.ogg');
this.load.audio('lampara1', 'assets/audio/lampara1.ogg');
this.load.audio('kraken3', 'assets/audio/kraken3.ogg');
this.load.audio('bien1', 'assets/audio/bien1.ogg');
this.load.audio('bien2', 'assets/audio/bien2.ogg');
this.load.audio('nervios1', 'assets/audio/nervios1.ogg');
this.load.audio('nervios2', 'assets/audio/nervios2.ogg');
this.load.audio('nervios3', 'assets/audio/nervios3.ogg');


this.load.image('preloader', 'assets/preloader.gif');
this.load.image('bedroom01', 'assets/bedroom_yellow.png');
Expand Down
8 changes: 6 additions & 2 deletions src/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
this.game.add.tileSprite(0, 0, 1452, 1746, 'bedroomFull');
this.game.world.setBounds(0, 0, 1452, 1746)


this.ratio = 1452 / 600;
this.goto = null;

Expand All @@ -42,13 +43,14 @@
this.createSolidObjects();

// Jugardor
this.player = this.game.add.sprite(260, 120, 'toki_sprite', 3);
this.player = this.game.add.sprite(260, 175, 'toki_sprite', 3);
this.player.scale.setTo(0.4, 0.4);

if(this.estadoAnterior){
this.player.playerVelocity = 300;
}


this.player.initialPlayerFrame = 3;
this.player.anchor.x = 0.5;
this.player.anchor.y = 0.5;
Expand Down Expand Up @@ -128,6 +130,8 @@
this.game.state.start('mini1');
}
else if ( this.game.physics.arcade.collide(this.player, this.kraken)){
this.game.audios.kraken3.play();

if (this.logrosCompletados()){
this.stopMovingPlayer(this.player);
this.game.state.start('minijuego05');
Expand All @@ -144,7 +148,7 @@
this.playerMovement(this.player);

if (logros[1] <= 0){
this.game.state.start(minijuego2.state_name);
this.game.state.start('minijuego02');
}

},
Expand Down
4 changes: 4 additions & 0 deletions src/js/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
var desplegar = papel.animations.add('desplegar');
papel.animations.play('desplegar', 3, false);

this.game.audios.papel3 = this.game.add.audio('papel3');
this.game.audios.papel3.play();

//Player.

this.player1 = this.game.add.sprite(348, 474, 'toki3');
Expand Down Expand Up @@ -47,6 +50,7 @@


this.song = this.game.add.audio('song1');
this.song.volume = 0.1;
this.song.loopFull();

},
Expand Down
5 changes: 4 additions & 1 deletion src/js/mini1.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Mini1.prototype = {
active: function() { this.game.time.events.add(Phaser.Timer.SECOND, this.createText, this); },
create: function () {

this.game.audios.papel3.play();

this.count = 1;

this.game.physics.startSystem(Phaser.Physics.P2JS);
Expand Down Expand Up @@ -102,7 +104,7 @@ Mini1.prototype = {
this.number1.visible = false;
this.number1a.visible = true;
this.arrayNumbers.push(1);

}, this);

this.number1a.events.onInputDown.add(function(){
Expand Down Expand Up @@ -246,6 +248,7 @@ Mini1.prototype = {
if (this.arraysEquals(this.arrayNumbers,[3,-1,1,4])){
this.game.state.start('game', true, false, 0);
console.log("LOGRO PASADO!!!!!!");
this.game.audios.bien1.play();
}


Expand Down
10 changes: 10 additions & 0 deletions src/js/minijuego02.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
this.numFrames = 3;
this.nowMinutes = new Date();
this.seleccionado = false;
this.game.audios.papel3.play();
this.game.audios.alarma1.volume = 0.6;
this.game.audios.alarma1.loopFull();
this.game.audios.movil1.loopFull();
//this.song.loopFull();

},

update: function () {
Expand Down Expand Up @@ -82,10 +88,14 @@

finKO : function(){
this.game.state.start('game', true, false);
this.game.audios.alarma1.stop();
this.game.audios.movil1.stop();
},

finOK : function(){
this.game.state.start('game', true, false, 1);
this.game.audios.alarma1.stop();
this.game.audios.movil1.stop();
}
};

Expand Down
7 changes: 6 additions & 1 deletion src/js/minijuego03.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var papel = this.game.add.sprite(0, 0, 'background');
var desplegar = papel.animations.add('desplegar');
papel.animations.play('desplegar', 8, false);

this.lampara = this.game.add.sprite(100, 0, 'lampara');
this.lamparaFrame = 0;

Expand All @@ -19,6 +19,8 @@
this.finalCounter = 10;

this.text = this.game.add.text(250, 16, '', { fill: '#ffffff' });
this.game.audios.papel3.play();

},

update: function () {
Expand All @@ -36,6 +38,7 @@
||(this.lampara.frame == 1 && this.isInside(this.game.input._x, this.game.input._y, 217, 245, 415, 440))){
this.lampara.frame = (this.lampara.frame + 1) % 2;
this.counter++;
this.game.audios.lampara1.play();
}
},

Expand All @@ -50,6 +53,8 @@
finOK : function(){
//this.text.text = "OK";
this.game.state.start('game', true, false, 2);
this.game.audios.bien2.play();

}
};

Expand Down
16 changes: 10 additions & 6 deletions src/js/minijuego04.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
this.lapices.setAll('body.bounce.y', 1);

this.text = this.game.add.text(50, 700, '', { fill: '#000' });
this.game.audios.papel3.play();

},

update: function () {
Expand All @@ -56,6 +58,8 @@
finOK: function(){
this.text.text = "OK";
this.game.state.start('game', true, false, 3 );
this.game.audios.bien1.play();

},

dropHandler: function(item, pointer){
Expand All @@ -70,7 +74,7 @@
for(var j = 0; j < this.numLapices; j++){
if(i != j){
var distance = this.lapices.children[i].position.distance(this.lapices.children[j].position)
if (distance >= 0 && distance <= 70){
if (distance >= 20 && distance <=100){
d++;
}
}
Expand All @@ -93,11 +97,11 @@
this.finOK();
}

if (sum < (this.limitOK*0.2)) this.text.text ="NOOOOOO, estoy muy nervioso!!!!!";
else if (sum < (this.limitOK*0.4)) this.text.text ="Bueno, estoy un poco nervioso.";
else if (sum < (this.limitOK*0.6)) this.text.text ="Vamos mejorando.";
else if (sum < (this.limitOK*0.8)) this.text.text ="Uy, casi!";
else if (sum> this.limitOK) this.text.text ="NOOOOOOOOO, están muy cercaaaaaaaa.";
if (sum < (this.limitOK*0.2)) this.text.text ="NOOOOOO, iiii'm really nervous!!";
else if (sum < (this.limitOK*0.4)) this.text.text ="Take it easy";
else if (sum < (this.limitOK*0.6)) this.text.text ="we aaare doing better";
else if (sum < (this.limitOK*0.8)) this.text.text ="Almost done";
else if (sum> this.limitOK) this.text.text ="NOOOOOOOOO, they are soooooo close";
}
};

Expand Down
7 changes: 4 additions & 3 deletions src/js/minijuego05.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
this.palabras.setAll('body.bounce.y', 1);

this.text = this.game.add.text(50, 700, '', { fill: '#000' });
this.game.audios.papel3.play();

},

update: function () {
Expand All @@ -50,10 +52,9 @@
},

finOK: function(){
this.game.state.start('game', true, false, 4);

this.text.text = "OK";
this.game.state.start('gameover');
this.game.audios.bien1.play();
},

dropHandler: function(item, pointer){
Expand All @@ -67,7 +68,7 @@
}
}
var desordenados = this.numPalabras - numPalabrasOrdenadas;
this.text.text = 'Solo faltan ' + desordenados + ' palabras por ordenar';
this.text.text = desordenados + ' words left to sort';
if (desordenados == 0){
this.finOK();
}
Expand Down
12 changes: 11 additions & 1 deletion src/js/minijuego06.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
this.calzoncillos.setAll('body.bounce.y', 1);

this.text = this.game.add.text(50, 700, '', { fill: '#000' });
this.game.audios.papel3.play();

},

update: function () {
Expand All @@ -54,6 +56,8 @@
finOK: function(){
this.text.text = "OK";
this.game.state.start('game', true, false, 5);
this.game.audios.bien2.play();

},

dropHandler: function(item, pointer){
Expand All @@ -66,10 +70,16 @@
}
}
var desordenados = this.numCalzoncillos - numCalzoncillosOrdenados;
this.text.text = 'Solo faltan ' + desordenados + ' calzoncillos por ordenar';
this.text.text = 'Just ' + desordenados + ' pants left to sort :S';
if (desordenados == 0){
this.finOK();
}
else{
//var rnd = new Phaser.RandomDataGenerator()
//var n = rnd.integerInRange(1,3);
var n = Math.floor((Math.random() * 8) + 1);
if(n < 4) this.game.audios['nervios'+n].play();
}
},

listenerCalzoncillo: function(item, pointer) {
Expand Down
50 changes: 43 additions & 7 deletions src/js/preloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,64 @@
preload: function () {
this.asset = this.add.sprite(this.game.width * 0.5 - 110, this.game.height * 0.5 - 10, 'preloader');
this.load.setPreloadSprite(this.asset);
// this.load.onLoadComplete.addOnce(this.onLoadComplete, this);
// this.loadResources();
this.load.onLoadComplete.addOnce(this.onLoadComplete, this);
this.loadResources();

this.ready = true;
this.ready = false;
this.game.soundReady = false;
},

loadResources: function () {
// load your assets here
this.load.audio('song1', 'assets/pisong.mp3');

var _self = this;



this.game.sounds = [];
this.game.audios = {};
//this.game.audios.alarma1 = this.game.add.audio('alarma1');
//this.game.audios.movil1 = this.game.add.audio('movil1');
addSound('movil1');
addSound('alarma1');
addSound('lampara1');
addSound('kraken3');
addSound('bien1');
addSound('bien2');
addSound('nervios1');
addSound('nervios2');
addSound('nervios3');
this.game.soundReady = false;

function addSound(name){
_self.game.audios[name] = _self.game.add.audio(name);
_self.game.sounds.push(_self.game.audios[name]);
}

// Being mp3 files these take time to decode, so we can't play them instantly
// Using setDecodedCallback we can be notified when they're ALL ready for use.
// The audio files could decode in ANY order, we can never be sure which it'll be.

this.game.sound.setDecodedCallback(this.game.sounds, this.soundEnd, this);
},

create: function () {

},

soundEnd: function(){
this.game.soundReady = true;
},

update: function () {
// if (!!this.ready) {
if (!!this.ready) {
// if (!!this.ready && this.game.soundReady) {
this.game.state.start('menu');
// }
}
},

onLoadComplete: function () {
// this.ready = true;
this.ready = true;
}
};

Expand Down

0 comments on commit da02db4

Please sign in to comment.