Jump to content

Search the Community

Showing results for tags 'score logic'.

  • 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. Hi Everyone, My score disappears every time I restart the game (AND IT'S DRIVING ME INSAAAAAAAAAANE). If I completely reload the server, it reappears at the top of the game where it should be. If I click the "Play Again" button from Game Over screen, my game loads again, sans "Score." Any insights as to how I can correct this problem would be greatly appreciated. Here is The Code: in main.js (where all my globals live) var score = 0; In StateMain.js under the create:function I have: create: function () { score = 0; //text this.scoreText=game.add.text(game.world.centerX+125, 100, "0"); this.scoreText.fill="#ffff00"; this.scoreText.fontSize = 55; this.scoreText.anchor.set(0.5, 0.5); this.scoreText.fixedToCamera = true; this.scoreLabel=game.add.text(game.world.centerX, 100, "Score: "); this.scoreLabel.fill="#ffff00"; this.scoreLabel.fontSize = 55; this.scoreLabel.anchor.set(0.5, 0.5); this.scoreLabel.fixedToCamera = true; } And here's my code for the incrementation: gotBomb: function (sprite, tile) { if (sprite.name == "monster") { return; } this.map.removeTile(tile.x, tile.y, this.layer); score++; this.scoreText.text = score; gameMedia.playSound(this.collectSound); if (score == 4) { gameMedia.playSound(this.victoryMusic); game.state.start("StateVictory"); } } Everything else works just fine except for this and I'm super-stumped. Thanks heaps in advance!!!!
×
×
  • Create New...