Jody Thai

Members
  • Content Count

    3
  • Joined

  • Last visited

About Jody Thai

  • Rank
    Newbie

Contact Methods

  • Twitter
    jodythai
  1. Hi, When the browser tab is out of focus, the game will pause, we all know that default setting. But is there a way to detect whenever it happen? I have my own countdown timer and when the game is paused this way, my timer still works so I need to detect it's status to pause my timer as well. Thanks, Jody
  2. Hi all, I have a group and want to reuse it in multiple states because the content inside this group will be the same, but currently it won't work in the second state, the group content is existed in this second state but it just never show up. Here is my codes: I have two variables in my main.js as below: (function (DaoMai) { var width = 640, height = width/(16/9); DaoMai.sceneBg; DaoMai.timeLeft = 60; DaoMai.countDownTimer = null; DaoMai.gameTime = 60; DaoMai.totalItem = 10; // all Tet items, including incorrect items DaoMai.selectedTree = null; DaoMai.mobileWidth = 0; DaoMai.mobileHeight = 0; DaoMai.gameRatio = 16/9; DaoMai.items = []; DaoMai.effectWrongItem; DaoMai.countDownTimer = null; DaoMai.timerInterval = null; DaoMai.bloomingTree; DaoMai.finalTree; DaoMai.finalTreeGroup; DaoMai.chosenTree = null; // 0 is cay Dao, 1 is cay Mai DaoMai.correctItem = 0; DaoMai.checkIcon; // the check icon at state choose tree DaoMai.checkIconTween; DaoMai.game = new Phaser.Game(width, height, Phaser.CANVAS, 'game'); DaoMai.game.state.add('Boot', DaoMai.Boot, true); DaoMai.game.state.add('Preloader', DaoMai.Preloader); DaoMai.game.state.add('MainMenu', DaoMai.MainMenu); DaoMai.game.state.add('StateChooseTree', DaoMai.StateChooseTree); DaoMai.game.state.add('StateTreeBlooming', DaoMai.StateTreeBlooming); DaoMai.game.state.add('StateMain', DaoMai.StateMain); // Now start the Boot state. DaoMai.game.state.start('Boot');}(window.DaoMai = window.DaoMai || {}));Then I create a group and a sprite in my state_tree_blooming.js. DaoMai.finalTreeGroup = this.game.add.group();DaoMai.finalTree = DaoMai.finalTreeGroup.create(0, 0, 'cayDaoBlooming');And then I want to re-use this group in another state, in this case state_I just want to re-locate this group in main.js as below: DaoMai.finalTreeGroup.x = 285;DaoMai.finalTreeGroup.y = 5;And nothing shows up. So I don't know whether a group can be used in multiple state or not, any help would be greatly appreciate. Thanks, Jody