I'm using Phaser.io
I just learned how to set a collider function:
this.physics.add.collider(enemies, platforms, function (enemy) {
enemy.destroy();
gameState.score += 10;
});
But I would like to do the same thing without the platform. Instead of the platform, I would like to use the world bounds.
I know you can set world bounds like this:
player.setCollideWorldBounds(true);
I've tried:
this.physics.add.collider(enemies, this.worldBounds, function (enemy) {
enemy.destroy();
gameState.score += 10;
});
But this doesn't work.
Any ideas?