Does phaser 3 have a built in method to do it ? I searched up online but couldn’t find a short and precise method. Plz help.
In the create() game:
this.isOutWorldBounds(object)
return (object.getBounds().right < 0 || object.getBounds().left > game.config.width || object.getBounds().bottom < 0 || object.getBounds().top > game.config.height)
}
If the objects are inside a group, do this in update():
this.group.getChildren().forEach(function (object) {
if (this.isOutWorldBounds(object))
{
//Put your code here
}
});
I have used it im my game that you can check in the link:
1 Like