Jump to content

Checking if a sprite overlap an other during its creation


Recommended Posts


i have this code that should create in the create function if one of the sprites of the "asteroids" group is overlapping the station (so the player doesnt get instant killed when he spawn).

It is working in the Asteroid.prototype.update function but to optimize the game i would like to check it in the create function.

this.asteroids.forEach(function (item) {
			if (Phaser.Rectangle.intersects(this.station.getBounds(), item.getBounds())) {
		}, this);

It isnt working as exepted, could soweone help me ?

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...