DudeshootMankill

BulletHell sidescroller help

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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.