Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update README

  • Loading branch information...
commit df9afb64197c3f66df6ffb88e9d16101935f37d5 1 parent 9994822
Luiz Gustavo Lino luizgustavolino authored
7 Classes/Capn.js
View
@@ -6,6 +6,7 @@ var Capn = cc.Sprite.extend({
crouchHitArea: {w:30,h:30,dx:0,dy:-40},
lifeMeter: null,
lifes: 5,
+ world: null,
init: function(){
this._super();
@@ -184,7 +185,11 @@ var Capn = cc.Sprite.extend({
var goDown = cc.MoveBy.create(.3, cc.ccp(0,-86));
- var sequence = cc.Sequence.create(jumpAndRotateAnm, endCallback, goDown);
+ var gameoverCallback = cc.CallFunc.create(this, function(){
+ this.world.changeState(PM.GAME_SCENE.GAMEOVER);
+ });
+
+ var sequence = cc.Sequence.create(jumpAndRotateAnm, endCallback, goDown, gameoverCallback);
this.stopAllActions();
this.runAction(sequence);
37 Classes/GameScene.js
View
@@ -37,6 +37,7 @@ var GameScene = cc.Layer.extend({
this.boat = new Boat();
this.boat.setPosition(cc.ccp(0,0));
+ this.boat.capn.world = this;
this.addChild(this.boat);
var upDownAction = cc.RepeatForever.create(
@@ -86,10 +87,11 @@ var GameScene = cc.Layer.extend({
var self = this;
gameCanvas.onmouseup = function(){
self.changeState(PM.GAME_SCENE.GAME);
+ if(self.state == PM.GAME_SCENE.GAMEOVER){
+ window.location.reload();
+ }
}
-
-
return true;
},
@@ -107,8 +109,11 @@ var GameScene = cc.Layer.extend({
changeState: function(_newstate){
+ var size = cc.Director.sharedDirector().getWinSize();
+
if(this.state == PM.GAME_SCENE.UNKNOWN && _newstate == PM.GAME_SCENE.MENU){
- this.gameOverLayer.setIsVisible(false);
+ this.state = PM.GAME_SCENE.MENU;
+ this.gameOverLayer.setPosition(cc.ccp(0,size.height));
}
if(this.state == PM.GAME_SCENE.MENU && _newstate == PM.GAME_SCENE.GAME){
@@ -141,17 +146,33 @@ var GameScene = cc.Layer.extend({
}
+ if(this.state == PM.GAME_SCENE.GAME && _newstate == PM.GAME_SCENE.GAMEOVER){
+
+ this.state = PM.GAME_SCENE.GAME2GAMEOVER;
+ this.gameOverLayer.totalScore = this.score;
+
+ var wait = cc.DelayTime.create(1.0);
+ var move = cc.EaseSineInOut.create(cc.MoveTo.create(0.8, cc.ccp(0,0)));
+ var onFadeEnd = cc.CallFunc.create(this, function () {
+ this.rebels.node.removeAllChildrenWithCleanup(false);
+ this.state = PM.GAME_SCENE.GAMEOVER;
+ });
+
+ this.gameOverLayer.stopAllActions();
+ this.gameOverLayer.runAction(cc.Sequence.create(wait,move, onFadeEnd));
+
+ }
+
},
updateScore: function(_new){
this.score += _new;
this.scoreLabel.setString("SCORE: " + zeroFill(this.score,5));
-
},
update:function(dt){
- if(this.state == PM.GAME_SCENE.GAME){
+ if(this.state == PM.GAME_SCENE.GAME || this.state == PM.GAME_SCENE.GAME2GAMEOVER){
this.rebels.update(dt);
@@ -190,7 +211,7 @@ var GameOverLayer = cc.LayerColor.extend({
this.gameLogo.setPosition(cc.ccp(size.width/2, 380));
this.addChild(this.gameLogo);
- this.scoreLabel = cc.LabelBMFont.create("THIS SESSION SCORE: 2300", "Resources/derp.fnt");
+ this.scoreLabel = cc.LabelBMFont.create("THIS SESSION SCORE: "+totalScore, "Resources/derp.fnt");
this.scoreLabel.setPosition(cc.ccp(130, 200+30));
this.scoreLabel.setAnchorPoint(cc.ccp(0,0));
this.addChild(this.scoreLabel);
@@ -199,7 +220,7 @@ var GameOverLayer = cc.LayerColor.extend({
this.hiscoreLabel.setPosition(cc.ccp(130, 175+30));
this.hiscoreLabel.setAnchorPoint(cc.ccp(0,0));
this.addChild(this.hiscoreLabel);
-
+ /*
this.leaderbordsLabel = cc.LabelBMFont.create("- LEADERBOARDS -", "Resources/derp.fnt");
this.leaderbordsLabel.setPosition(cc.ccp(size.width/2, 182));
this.addChild(this.leaderbordsLabel);
@@ -214,7 +235,7 @@ var GameOverLayer = cc.LayerColor.extend({
this.addChild(wLabel);
}
-
+ */
}
});
3  Classes/PirateMutiny.js
View
@@ -19,7 +19,8 @@ PM.GAME_SCENE = {
MENU:1,
MENU2GAME:2,
GAME:3,
- GAMEOVER:4
+ GAME2GAMEOVER:4,
+ GAMEOVER:5
}
7 README.md
View
@@ -1,6 +1,11 @@
## Pirate Mutiny
-Arrr!
+Arrr! On Pirate Mutiny you take the role of a captain deposed from your ship.
+Your rebellious crew will do anything to push you off the plank and your goal is to avoid them by jumping and ducking.
+
+Are you tough enough to keep yourself dry?
+PLAY ONLINE AT [www.tsubasa.com.br/jams/ggo12] (http://www.tsubasa.com.br/jams/ggo12/)
+
Open source tools:
* [Cocos2D HTML5] (http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Html5)
BIN  Resources/pm.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.