Mike018 Posted April 17, 2016 Share Posted April 17, 2016 Without using phaser, I can do something like this. ctx.clearRect(0, 0, GAME_WIDTH, GAME_HEIGHT); Currently I just have rectangles and no sprites. I've even tried to convert the rectangles to bitmap and do this: var bmd = game.add.bitmapData(0,0); bmd.ctx.clearRect(0, 0, game.world.width, game.world.height); All within function create() Also, is there a way to just clear the objects that are moving and leave the static images? I'd imagine that would be more performant. Link to comment Share on other sites More sharing options...
drhayes Posted April 18, 2016 Share Posted April 18, 2016 You should probably think in terms of Sprites, not canvas context calls: http://phaser.io/examples/v2/category/sprites If you need to create things dynamically, you can draw to a BitmapData and use that as the texture for a sprite. Phaser will, by default, clear the canvas between renders unless you tell it not to -- but I'd make the game first and save the performance optimizations for later when you're sure you need them. "Sure you need them" as in "measured with a profiler and determined exactly where the problem is". samme 1 Link to comment Share on other sites More sharing options...
charlieRobinson Posted September 4, 2017 Share Posted September 4, 2017 Is there no way to clear the screen in the update function with phaser? Link to comment Share on other sites More sharing options...
samme Posted September 5, 2017 Share Posted September 5, 2017 It's more a matter of what are you really trying to do. Do you want to restart the game/scene? Do you want to remove all the existing game objects? Do you want to hide (but keep) all the existing game objects? Do you want to flash all black for a moment? Link to comment Share on other sites More sharing options...
Recommended Posts