menu.js 912 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. (function() {
  2. 'use strict';
  3. function Menu() {
  4. this.titleTxt = null;
  5. this.startTxt = null;
  6. }
  7. Menu.prototype = {
  8. create: function () {
  9. var x = this.game.width / 2
  10. , y = this.game.height / 2;
  11. this.titleTxt = this.add.bitmapText(x, y, 'minecraftia', 'Example Game' );
  12. this.titleTxt.align = 'center';
  13. this.titleTxt.x = this.game.width / 2 - this.titleTxt.textWidth / 2;
  14. y = y + this.titleTxt.height + 5;
  15. this.startTxt = this.add.bitmapText(x, y, 'minecraftia', 'START');
  16. this.startTxt.align = 'center';
  17. this.startTxt.x = this.game.width / 2 - this.startTxt.textWidth / 2;
  18. this.input.onDown.add(this.onDown, this);
  19. },
  20. update: function () {
  21. },
  22. onDown: function () {
  23. this.game.state.start('game');
  24. }
  25. };
  26. window['trexrunner'] = window['trexrunner'] || {};
  27. window['trexrunner'].Menu = Menu;
  28. }());