Jump to content

Search the Community

Showing results for tags 'restart state'.

  • 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 doing a round based game. So after you've killed so many enemies it'll pop up, "Round 1", after some more, "Round 2" and so on. The amount of enemies doesn't change it's just the round that increases after you've killed say 20 enemies. I have a current variable at the top of my game.js file var currRound = 1; var EnemiesKilled = 0; Every time I kill an enemy I increment up the variable then in one of the collision handlers I do if EnemiesKilled == 20 then show some text newLevel.setText("Woo!! Round " + currRound + "!"); and restart the round via setTimeout(function() { game.state.start(game.state.current); }, 1000); The thing is, it whipes the variable of EnemiesKilled. How can I keep that variable so I always know how many enemies the player has killed?
×
×
  • Create New...