Jump to content

Search the Community

Showing results for tags 'menu states'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. I'm currently having troubles with states in my game. I just started using it so I'm certain I'm making a dumb mistake, but if you could help I would really appreciate it. The problem I'm having is that when I hit the Space Button, it triggers the start function in stateMENU again and again. Shouldn't the stateMENU end and not respond/react anymore? If you need any more information, let me know. Here's My Code This is in LOAD.js: var stateLOAD = { preload: function(){ this.game.stage.backgroundColor = "#FF0921"; this.game.load.spritesheet('player','redThief.png',50,95); }, create: function(){ this.game.state.start('menu'); }}; This is in MENU.js: var stateMENU = { create: function(){ game.stage.backgroundColor = "#8A8A8A"; var spaceBttn = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); spaceBttn.onDown.add(this.start,this); }, start: function(){ console.log('start'); this.game.state.start('play'); }};This is in PLAY.js: var bgColor = "#678543";var statePLAY = { create: function(){ console.log('CREATE'); game.stage.backgroundColor = bgColor; var moveKeys = game.input.keyboard.createCursorKeys(); }};^ When you hit spacebar during the 'play' phase, it triggers the code in the start function in stateMENU and the console logs 'start' along with 'create'. This is in GAME.js: var game = new Phaser.Game(600,400,Phaser.AUTO,'gameDIV');game.state.add('load',stateLOAD);game.state.add('menu',stateMENU);game.state.add('play',statePLAY);game.state.start('load');
×
×
  • Create New...