Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
noliv authored and noliv committed Sep 6, 2015
2 parents d9646d6 + 0d47b2b commit 18e621e
Show file tree
Hide file tree
Showing 20 changed files with 7,766 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/nbproject/private/
/node_modules/
.DS_Store
/nbproject/
/nbproject/
*.png_1
Binary file added assets/images/credits-txt.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 assets/images/credits.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 assets/images/icon-x152.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 assets/images/icon-x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,008 changes: 2,008 additions & 0 deletions assets/images/sources/credits-txt.ai

Large diffs are not rendered by default.

2,090 changes: 2,090 additions & 0 deletions assets/images/sources/credits.ai

Large diffs are not rendered by default.

1,758 changes: 1,758 additions & 0 deletions assets/images/sources/icon.ai

Large diffs are not rendered by default.

1,805 changes: 1,805 additions & 0 deletions assets/images/sources/taches-pix.ai

Large diffs are not rendered by default.

Binary file added assets/images/taches-pix.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 assets/images/taches.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="apple-touch-icon" href="assets/images/icon-x180.png" />
<script data-main="src/main" src="node_modules/requirejs/require.js"></script>
<style>
@font-face {font-family:"slkscr";src:url('assets/font/slkscr.woff');}
Expand Down
38 changes: 29 additions & 9 deletions src/scenes/game.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define([
'phaser', 'sprites/building', 'sprites/bbq', 'sprites/rescue', 'sprites/jumpers'
], function (Phaser, Building, Bbq, Rescue, Jumpers ) {
'phaser', 'sprites/building', 'sprites/ground', 'sprites/bbq', 'sprites/rescue', 'sprites/jumpers', 'sprites/splash'
], function (Phaser, Building, Ground, Bbq, Rescue, Jumpers, Splash ) {
'use strict';

function Game(game) {
Expand Down Expand Up @@ -89,7 +89,8 @@ define([
// Collide the player and the stars with the platforms
this.game.physics.arcade.collide(this.jumpers, this.bbq, this.burn, null, this);
this.game.physics.arcade.collide(this.jumpers, this.trampoline, this.rescue);
this.game.physics.arcade.collide(this.jumpers, this.building.windows, null, this.swwuuiiii);
this.game.physics.arcade.collide(this.jumpers, this.building.windows, null, this.swwuuiiii);
this.game.physics.arcade.collide(this.jumpers, this.ground, this.splash, null, this);
this.updateNuagesPosition();

/*
Expand Down Expand Up @@ -142,8 +143,8 @@ define([
this.nuage2 = this.game.add.sprite(290, 220, 'nuage2');
this.nuage2.scale.setTo(0.5, 0.5);

this.building = new Building(this.game)

this.building = new Building(this.game);
this.ground = new Ground(this.game);
},

setupForeground: function() {
Expand Down Expand Up @@ -180,7 +181,7 @@ define([
scene.countViesHumaines=3;

// 3. on setup les fonctions de désincrémentation des scores sur l'objet Phaser.game qui est accessible de partout et qui possédera une référence vers la scène game dans la fonction.
this.game.loseSaucisse = function(){
this.game.loseSausage = function(){
if (scene.countViesSaucisses>0) {
scene.countViesSaucisses--;
scene.viesSaucisses[scene.countViesSaucisses].frame=1;
Expand All @@ -189,7 +190,7 @@ define([
console.log('GAME OVER');
}
};
this.game.loseHumain = function(){
this.game.loseHuman = function(){
if (scene.countViesHumaines>0) {
scene.countViesHumaines--;
scene.viesHumaines[scene.countViesHumaines].frame=1;
Expand Down Expand Up @@ -225,13 +226,22 @@ define([
if(jumper.key == "human") {
jumper.kill();
bbq.play('burn', 20);
this.score -= 1;
this.scoreText.text = 'Score: ' + this.score;
bbq.game.loseHuman();
this.score -= 1;
this.scoreText.text = 'Score: ' + this.score;

var cri_human = this.game.add.audio('cri_wilhelm');
cri_human.play();
}
else {
jumper.stop();
this.score += 1;

var cri_saucisse = this.game.add.audio('cri_saucisse');
cri_saucisse.play();

this.scoreText.text = 'Score: ' + this.score;

}
},

Expand All @@ -250,6 +260,16 @@ define([
}
//console.log(obj);
return false;
},

splash: function(ground, jumper) {
jumper.kill();
if(jumper.key == "human") {
ground.game.loseHuman();
} else {
ground.game.loseSausage();
}
this.jumpers.add(new Splash(ground.game, jumper.x, ground.y - 10, jumper.key == "human" ? 0 : 1));
}
};

Expand Down
27 changes: 23 additions & 4 deletions src/scenes/preloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,28 @@ define([

this.sprites = [
['bbq', 'assets/images/bbq-sprites.png', 90, 130, 6],
['splash', 'assets/images/taches.png', 80, 30, 2],
['sausage', 'assets/images/so6.png', 64, 192, 4],
['human', 'assets/images/humans.png', 64, 219, 5],
['window', 'assets/images/fenetres.png', 120, 120, 7],
['play-spritesheet', 'assets/images/play-spritesheet.png', 210,140,2],
['vie-humaine', 'assets/images/icone-mort-humain.png', 50,60,2],
['vie-saucisse', 'assets/images/icone-saucisse-ratee.png', 30,60,2],
];

this.scripts = [
['webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js'],
]

this.audio = [
['webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js'],
['zik-intro', 'assets/sounds/sausage_squad_intro_master.mp3'],
['zik', 'assets/sounds/sausage_squad_master.mp3'],
['clic', 'assets/sounds/clic_menu_1.wav'],
['cri_wilhelm', 'assets/sounds/cri_wilhelm.wav'],
['cri_saucisse', 'assets/sounds/cri_2.wav'],
['cri_saucisse_sol', 'assets/sounds/cri_3.wav'],
];
}

Preloader.prototype = {
Expand Down Expand Up @@ -57,10 +72,14 @@ define([
this.game.load.spritesheet(this.sprites[key][0], this.sprites[key][1], this.sprites[key][2], this.sprites[key][3], this.sprites[key][4]);
}

this.game.load.audio('zik-intro', 'assets/sounds/sausage_squad_intro_master.mp3');
this.game.load.audio('zik', 'assets/sounds/sausage_squad_master.mp3');
this.game.load.audio('clic', 'assets/sounds/clic_menu_1.wav');
this.game.load.audio('cri_wilhelm', 'assets/sounds/cri_wilhelm.wav');
for(var key in this.scripts) {
this.game.load.script(this.scripts[key][0], this.scripts[key][1], this.scripts[key][2], this.scripts[key][3], this.sprites[key][4]);
}

for(var key in this.audio) {
this.game.load.audio(this.audio[key][0], this.audio[key][1], this.audio[key][2], this.audio[key][3], this.audio[key][4]);
}

},
create: function () {
// Once the load has finished we disable the crop because we're going to sit in the update loop for a short while as the music decodes
Expand Down
4 changes: 3 additions & 1 deletion src/sprites/building.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ define([
for (var i = 0; i < 5; i++) {
for (var j = 0; j < 3; j++) {
if (!(i == 4 && j == 1)) {
this.windows.add(new Window(this.game, 112 + j * 60, 200 + i * 60, wType[i][j]));
var window = new Window(this.game, 97 + j * 60, 200 + i * 60, wType[i][j]);
this.windows.add(window);
// this.game.debug.body(window);
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions src/sprites/ground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
define([
'phaser'
], function (Phaser) {
'use strict';

function Ground(game) {
Phaser.Sprite.call(this, game, 0, game.height - 60);

game.physics.enable(this, Phaser.Physics.ARCADE);
this.body.immovable = true;
// Cannot set offset off box here cannot understand why (working in BBQ). Moving windows instead...
this.body.setSize(game.width, 60);

game.add.existing(this);
}

Ground.prototype = Object.create(Phaser.Sprite.prototype);
Ground.prototype.constructor = Ground;

return Ground;
});
6 changes: 1 addition & 5 deletions src/sprites/human.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ define([
Human.prototype = Object.create(Phaser.Sprite.prototype);
Human.prototype.constructor = Human;
Human.prototype.update = function () {
if (this.y > this.game.height - 88 && !this.lostHuman) {
this.lostHuman = true;
this.game.loseHumain();
}
};
Human.prototype.stop = function () {
this.body.velocity.x = 0;
Expand All @@ -51,7 +47,7 @@ define([
}
};
Human.prototype.scream = function () {
this.cri.play();
//this.cri.play();
};
Human.prototype.disappear = function () {
this.game.add.tween(this).to( { alpha: 0 }, 1500, "Quart.easeIn", true);
Expand Down
4 changes: 0 additions & 4 deletions src/sprites/sausage.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ define([
Sausage.prototype.constructor = Sausage;
Sausage.prototype.update = function () {
this.body.angularVelocity=this.body.angularVelocity*0.9;
if (this.y > this.game.height - 89 && !this.lostSausage) {
this.lostSausage = true;
this.game.loseSaucisse();
}
};
Sausage.prototype.stop = function () {
this.body.velocity.x = 0;
Expand Down
22 changes: 22 additions & 0 deletions src/sprites/splash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
define([
'phaser'
], function (Phaser) {
'use strict';

function Splash(game, x, y, type) {
Phaser.Sprite.call(this, game, x, y, 'splash', type);
this.anchor.setTo(0.5, 0.5);
this.scale.setTo(0.5, 0.5);

game.time.events.add(Phaser.Timer.SECOND * 3, this.disappear, this);
}

Splash.prototype = Object.create(Phaser.Sprite.prototype);
Splash.prototype.constructor = Splash;
Splash.prototype.disappear = function() {
this.game.add.tween(this).to( { alpha: 0 }, 6000, "Quart.easeIn", true);
this.game.time.events.add(Phaser.Timer.SECOND * 1.1, this.kill, this);
}

return Splash;
});
7 changes: 3 additions & 4 deletions src/sprites/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ define([
this.winType = type; //Math.floor(Math.random() * 7) + 1;;
Phaser.Sprite.call(this, game, x, y, 'window', this.winType);
game.physics.enable(this, Phaser.Physics.ARCADE);
this.anchor.setTo(0.5, 0.5);
this.anchor.setTo(0.25, 0.5);
this.body.immovable = true;
this.body.setSize(30, 1, this.width/2 - 15, this.height / 2);

// Cannot set offset off box here cannot understand why (working in BBQ). Moving windows instead...
this.body.setSize(30, 2);

//game.physics.enable(this, Phaser.Physics.ARCADE);
this.anchor.setTo(0.5, 0.5);
this.scale.setTo(0.5, 0.5);

game.add.existing(this);
Expand Down

0 comments on commit 18e621e

Please sign in to comment.