Jump to content

BulletHell sidescroller help


DudeshootMankill
 Share

Recommended Posts

Hey guys, i'm making a sidescroller with phaser and tiled. I've run into some problems with the gun function. I collide my bullet group like this.

this.game.physics.arcade.collide(this.bullet, this._collision_layer, this._kill_bullet, null, this);

and the function goes like this:

    _kill_bullet(bullet, _collision_layer) {
        bullet.kill();
    }

this._collision_layer is a tilemap. Now the bullets collide and destroy pretty well, when fired at a low rate of fire. But when i ramp out the speed and rate of fire, the bullets start passing through the collision layer. Especially at angles.

If i try to check for overlap instead, the bullet is destroyed instantly. I believe this is because the bounding box encapsulates all of the tilemaplayer.

Does anyone have any insights they could share with me here? Some pointers possibly?

Link to comment
Share on other sites

I figured this out on my own. What i did was this:

 

this.physics.arcade.overlap(this.bullets, this._collision_layer, function (bullet, _collision_layer) {
    bullet.kill();
}, function (particle, _collision_layer) {
    return _collision_layer.collides;
}, this);
 

Following this article

https://github.com/hexus/phaser-arcade-slopes/issues/7

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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