Hi,
Almost there…
Working with the official demo.
Everything is working except when we play a second game?
The 12 stars show at top of screen, but do not fall(physics)?
Also the player is not shown either?
You can play the current build on Itch below:
The full source code is below as well:
https://bitbucket.org/jesseleepalser/phaser-engine/src/master/
I’ll continue to work on this, but if you see something let me know here.
Thanks!
Jesse Lee
samme
April 26, 2023, 10:49pm
2
After
this.physics.pause()
you need
this.physics.resume()
For game object destruction, do
player.destroy();
platforms.destroy(true);
stars.destroy(true);
bombs.destroy(true);
Only group destroy()
has the destroyChildren
argument.
Hi,
Game now crashes in phaser.min.js on 2nd game, so I can’t pinpoint the crash in my source code.
I’ve updated the source code repository below:
https://bitbucket.org/jesseleepalser/phaser-engine/src/master/
If you would like to run the game on Itch then visit below URL:
Very lost here, hope you can figure this out.
Jesse Lee
Sorry it crashes on below code, please advise:
//--------------------------------------------------------------------------------------------------------------
function DeleteAllVisualsForGameOver ()
{
// platforms.destroy(true); // CRASHES?
player.destroy();
// stars.destroy(true); // CRASHES?
// bombs.destroy(true); // CRASHES?
}
//--------------------------------------------------------------------------------------------------------------
I got it running on 2nd run, but unable to delete demo platforms, stars, or bombs?:
https://bitbucket.org/jesseleepalser/phaser-engine/src/f6caf2956f32d0b04dc3fc38601f5b6e5d4fb0c4/coreLogic.js#lines-53
//--------------------------------------------------------------------------------------------------------------
function DeleteAllVisualsForGameOver ()
{
// platforms.destroy(true); // CRASHES on second run of game?
player.destroy();
// stars.destroy(true); // CRASHES on second run of game?
// bombs.destroy(true); // CRASHES on second run of game?
}
//--------------------------------------------------------------------------------------------------------------
samme
April 27, 2023, 11:41am
8
This error happens because the colliders you added with add.collider()
are still running but their game objects have been destroyed.
You can remove the colliders and then replace them.
playerBombsCollider = this.add.collider(/*…*/);
// …
this.physics.world.removeCollider(playerBombsCollider);
That worked - demo game 100%
Moving forward!