Jump to content

Search the Community

Showing results for tags 'add sprite'.

  • 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. This may be a very simple question. I have this basic platformer game. At the end, when the player reaches a certain x/y coordinate, the game ends. My endGame function looks like so : endGame: function(){ this.player.kill(); this.game.add.sprite(200,100,'congratulations'); }This function is called in the update part of my code : if(Math.round(this.player.position.x/32 + 1) == 12 && Math.round(this.player.position.y/32 + 1) <= 15) { this.endGame();}I am aware this may not be the cleanest and simplest way to do this, but I am fairly new to phaser. My problem is, as soon as the game ends, the 'congratulations' sprite is added 60 times per second, which is obviously considerably slowing my fps rate. How can I avoid this? Is there a way to add my sprite in the create part of my code, but only show it when the endGame sprite is called? Thanks!
×
×
  • Create New...