Skip to content

Commit

Permalink
Add Credits
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Chartrand committed Dec 1, 2012
1 parent 29bcbe4 commit 900a126
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
15 changes: 8 additions & 7 deletions RtL.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion pauseMenu.js
Expand Up @@ -69,6 +69,7 @@ robert_the_lifter.PauseMenu.prototype.initPauseMenu = function() {
if (e.event.offsetY <= 360) {
this.initOptionsMenu();
} else if (e.event.offsetY <= 435) {
this.showCredits();
console.log("Credits");
} else {
this.unpause();
Expand Down Expand Up @@ -128,7 +129,35 @@ robert_the_lifter.PauseMenu.prototype.initOptionsMenu = function() {
}
}
}
goog.events.listen(this.game.pauseMenu,['mousedown','touchstart'], this.currentMenuEvent);
goog.events.listen(this.game.pauseMenu, ['mousedown','touchstart'], this.currentMenuEvent);
}

robert_the_lifter.PauseMenu.prototype.hideCredits = function() {
this.removeChild(this.creditSprite);
goog.events.unlisten(this.game.pauseMenu, ['mousedown','touchstart'], this.clickToCloseCreditEvent);
}

robert_the_lifter.PauseMenu.prototype.showCredits = function() {
this.removeCurrentMenu();
var width = 661,
height = 900;
var x = (this.game.factoryWidth / 2) - (width/2);

var creditTile = new lime.fill.Frame('images/credits_menu.png', 0, 0, width, height);
this.creditSprite = new lime.Sprite()
.setAnchorPoint(0,0)
.setPosition(x, 0)
.setFill(creditTile);
this.appendChild(this.creditSprite);

var layer = this;

this.clickToCloseCreditEvent = function() {
layer.hideCredits();
layer.initPauseMenu();
}

goog.events.listen(this.creditSprite, ['mousedown','touchstart'], this.clickToCloseCreditEvent);
}

robert_the_lifter.PauseMenu.prototype.showKeyBindingMenu = function() {
Expand Down Expand Up @@ -200,6 +229,7 @@ robert_the_lifter.PauseMenu.prototype.removeCurrentMenu = function() {
this.removeChild(this.sfxStatus);
}

this.hideCredits();
this.hideKeyBindingMenu();
goog.events.unlisten(this.game.pauseMenu,['mousedown','touchstart'], this.currentMenuEvent);
}
Expand Down
2 changes: 2 additions & 0 deletions robert_the_lifter.js
Expand Up @@ -25,6 +25,8 @@ robert_the_lifter.start = function() {
// load menu images.
new lime.fill.Frame('images/pause_menu.png', 0, 0, 446, 226);
new lime.fill.Frame('images/options_menu.png', 0, 0, 446, 305);
new lime.fill.Frame('images/credits_menu.png', 0, 0, 661, 900);


// For chrome, images doesn't load on first hit. We show a warning message.
if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
Expand Down

0 comments on commit 900a126

Please sign in to comment.