Skip to content

Commit

Permalink
Merge con master
Browse files Browse the repository at this point in the history
  • Loading branch information
Goico91 committed Jan 31, 2016
2 parents 744e183 + 1e534fe commit f82b521
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 13 deletions.
Binary file added src/assets/bocadillo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tokigameover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
<script src="js/game.js"></script>
<script src="js/main.js"></script>
<script src ="js/mini1.js"></script>
<script src ="js/gameover.js"></script>
<!-- yo phaser:state new-state-files-put-here -->
<script src="js/minijuego02.js"></script>
<script src="js/minijuego02.js"></script>
<script src="js/minijuego03.js"></script>
<script src="js/minijuego04.js"></script>
<script src="js/minijuego05.js"></script>
Expand Down
4 changes: 3 additions & 1 deletion src/js/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@
this.load.image('mesa', 'assets/mesa.png');
this.load.image('toki', 'assets/toki.png');
this.load.spritesheet('toki3', 'assets/toki3.png', 348, 474);
this.load.spritesheet('tokigameover', 'assets/tokigameover.png', 348, 474);
this.load.spritesheet('background', 'assets/backgroundanimation.png', 600, 800, 4);

this.load.spritesheet('toki_sprite', 'assets/Toki-Sprite.png', 380, 462);

this.load.image('1px', 'assets/1px.png');
this.load.image('nexusback', 'assets/nexusback.png');

Expand Down Expand Up @@ -123,7 +125,7 @@
this.game.scale.maxHeight = 480;
this.game.scale.forceOrientation(true);
this.game.scale.pageAlignHorizontally = true;
this.game.scale.setScreenSize(true);
//this.game.scale.setScreenSize(true);
}
this.game.state.start('preloader');
}
Expand Down
23 changes: 14 additions & 9 deletions src/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@
this.createSolidObjects();

// Jugardor
this.player = this.game.add.sprite(260, 220, 'toki_sprite', 3);

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

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

this.player.playerVelocity = 300;


this.player.initialPlayerFrame = 3;
this.player.anchor.x = 0.5;
this.player.anchor.y = 0.5;
Expand All @@ -66,7 +65,13 @@
this.stopMovingPlayer(this.player);

this.cursors = this.game.input.keyboard.createCursorKeys();
//this.game.input.onDown.add(this.animateSprite, this)
//this.game.input.onDown.add(this.playerMovement, this)
this.game.input.onDown.add(function (){
console.log('test');
this.goto = new Phaser.Rectangle(this.game.input.x + this.game.camera.x, this.game.input.y + this.game.camera.y, 2, 2);

}, this)
//this.game.input.onUp.add(this.stopMovingPlayer, this)
},

showAction: function(action, stateName){
Expand Down Expand Up @@ -136,7 +141,7 @@
this.hideActions();
}

this.playerMovements(this.player);
this.playerMovement(this.player);

if (logros[1] <= 0){
this.game.state.start(minijuego2.state_name);
Expand Down Expand Up @@ -251,9 +256,9 @@

},

playerMovements: function(player) {
playerMovement: function(player) {
if (this.game.input.mousePointer.isDown){
this.goto = new Phaser.Rectangle(this.game.input.x + this.game.camera.x, this.game.input.y + this.game.camera.y, 2, 2);
//this.goto = new Phaser.Rectangle(this.game.input.x + this.game.camera.x, this.game.input.y + this.game.camera.y, 2, 2);
}

//if (!Phaser.Rectangle.contains(this.player.body, this.game.goto.x, this.game.goto.y)){
Expand Down
65 changes: 65 additions & 0 deletions src/js/gameover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
(function() {
'use strict';

function GameOver() {}

GameOver.prototype = {
active: function() {
this.game.time.events.add(Phaser.Timer.SECOND, this.createText, this);
},
create: function () {
this.count = 1;
this.input.onDown.add(this.onDown, this);

// animation background
var papel = this.game.add.sprite(0, 0, 'background');
var desplegar = papel.animations.add('desplegar');
papel.animations.play('desplegar', 3, false);

//Player.

this.player1 = this.game.add.sprite(328, 424, 'tokigameover');
this.player1.scale.setTo(0.75, 0.75);

//this.player.playerVelocity = 300;
//this.player.initialPlayerFrame = 1;

// Activamos las físicas en el player


// Añadimos las animaciones
this.player1.animations.add('parpadear', [0, 1], 10, true);
this.player1.animations.play('parpadear', 2, true);

// var text = this.add.text(this.game.width * 0.5, this.game.height * 0.5 *0.5,
// 'MENU', {font: 'Indie Flower', fill: '#111111', align: 'center', fontSize: 50
// });
var text = this.game.add.text(90,100, "GAME OVER", {font: 'IndieFlower', fill:'#111111', fontSize: 100});
var text2 = this.game.add.text(110,230, "Thanks for making \nmy life a little \nmore bearable. \n\n", {font: 'IndieFlower', fill:'#111111', fontSize: 50});
var text3 = this.game.add.text(80,500, "Now...\n GO OUT!", {font: 'IndieFlower', fill:'#111111', fontSize: 50});
var text4 = this.game.add.text(100,700, "Signed:\n \t\t TOKI", {font: 'IndieFlower', fill:'#111111', fontSize: 30});
//text.anchor.set(0.5);


this.player1.inputEnabled = true;
this.player1.events.onInputDown.add(function(){
this.game.state.start('game');
}, this);


},

update: function () {
// if(this.count == 1)
// this.text = this.game.add.text(100,100,"MENU", {font: 'Indie Flower', fill:'#111111', fontSize: 50});
// this.text = "MENU"
// this.count++;
},

onDown: function () {
}
};

window['tocme'] = window['tocme'] || {};
window['tocme'].GameOver = GameOver;
}());
2 changes: 2 additions & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ window.addEventListener('load', function () {
game.state.add('preloader', ns.Preloader);
game.state.add('menu', ns.Menu);
game.state.add('mini1', ns.Mini1);
game.state.add('gameover', ns.GameOver);

game.state.add('minijuego02', ns.MiniJuego02);
game.state.add('minijuego03', ns.MiniJuego03);
game.state.add('minijuego04', ns.MiniJuego04);
Expand Down
7 changes: 5 additions & 2 deletions src/js/minijuego05.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

update: function () {
//this.game.physics.arcade.collide(this.lapices);


},

onDown: function () {
Expand All @@ -51,6 +51,9 @@

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

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

dropHandler: function(item, pointer){
Expand Down

0 comments on commit f82b521

Please sign in to comment.