congratsState.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. function CongratsState() {
  2. CongratsState.superclass.constructor.apply(this);
  3. this.back = null;
  4. this.cat = null;
  5. this.bNext = null;
  6. this.blank = null;
  7. this.a10Logo = null;
  8. this.moreGames = null;
  9. }
  10. extend(CongratsState, TrinState);
  11. CongratsState.prototype.create = function() {
  12. CongratsState.superclass.create.apply(this);
  13. this.back = new TrinSprite();
  14. this.back.addAnimationFromCache("CompleteBack");
  15. this.cat = new TrinSprite();
  16. this.cat.addAnimationFromCache("CongratsCat");
  17. this.bNext = new TrinButton(function() {
  18. _TrinGame.switchState(new MainMenuState());
  19. }, "bNext", false);
  20. this.bNext.orign.x = this.bNext.width;
  21. this.bNext.orign.y = this.bNext.height;
  22. this.bNext.reset(632, _TrinGame.visibleArea.bottom - 8);
  23. this.blank = new TrinRectObject(0, 0, 640, 960, "#FFFFFF");
  24. var a10Logo = new TrinButton(function() {
  25. //_TrinGame.SPIL_LOGO.action();
  26. }, "A10Logo", true);
  27. a10Logo.orign.y = a10Logo.height;
  28. a10Logo.reset(8, _TrinGame.visibleArea.bottom - 8);
  29. this.a10Logo = a10Logo;
  30. var bMoreGames = new TrinButton(function() {
  31. _TrinGame.SPIL_MOREGAMES.action();
  32. }, "bMoreGames", true);
  33. bMoreGames.orign.x = bMoreGames.width;
  34. bMoreGames.reset(632, _TrinGame.visibleArea.top + 8);
  35. this.moreGames = bMoreGames;
  36. this.add(this.back);
  37. this.add(this.cat);
  38. this.add(this.bNext);
  39. this.add(this.blank);
  40. this.add(this.a10Logo);
  41. this.add(this.moreGames);
  42. };
  43. CongratsState.prototype.update = function() {
  44. CongratsState.superclass.update.apply(this);
  45. this.blank.alpha = Math.max(this.blank.alpha - 0.1, 0);
  46. };
  47. CongratsState.prototype.resized = function() {
  48. this.bNext.y = this.a10Logo.y = _TrinGame.visibleArea.bottom - 8;
  49. this.moreGames.y = _TrinGame.visibleArea.top + 8;
  50. };