Jump to content

[1.1.5] This is a bug? bullet collision with tiles


AlexArroyoDuque
 Share

Recommended Posts

Hello. 

I have seen several posts that talk about this topic. 

I do not understand what happens when the bullets hit platforms. 

Function when the collision occurs is not executed. 

This only happens when the bullet hits a group of platforms.

 

This is my code

create:


            this.bullets = this.game.add.group();

            this.bullets.createMultiple(30, 'bullet');

            this.bullets.forEach(utils.setupBullet, this);

  utils.setupBullet = function(bullet) {

    bullet.anchor.x = 0.5;

    bullet.anchor.y = 0.5;

    bullet.outOfBoundsKill = true;

    bullet.lifespan = 2300;

    bullet.body.setCircle(15);

    bullet.animations.add('default', [0, 1, 2, 1], 10, true);

    bullet.animations.play('default');

  };

 


update:


     this.game.physics.overlap(this.bullets, this.layer, this.collisionBulletWall, null, this);

 

collisionBulletWall: function(bullet, wall) {


            bullet.kill();

        }

 

 

any idea?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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