Jump to content

Group revive revives at random position


microspace
 Share

Recommended Posts

I'm creating group of items (barrels). After killing some of items with weapon, I call items.callAll('revive');, but barrels are spawning in random position. Who came across with this problem?

items = this.game.add.group();
items.enableBody = true;
// inside for loop:
var sprite = group.create(element.x, element.y, 'barrel');
Link to comment
Share on other sites

I do this:

       //bullets

        weapon.bulletKillType = Phaser.Weapon.KILL_WORLD_BOUNDS;
        weapon.bulletAngleOffset = 0;
        weapon.bulletSpeed = 400;
        weapon.fireAngle = Phaser.ANGLE_RIGHT; // shoot at right direcion by default
        weapon.trackSprite(player, 0, -9, false); //-65 выведено экспериментальным путём
        //weapon.addBulletAnimation("fly", [0, 1, 2, 3, 4, 5, 6, 7], 40, true);

 

this code  executes when bullet hits barrel:

    bulletHitBarrel: function(sprite, bullet) {
        var damage = 48;
        sprite.damage(damage);
        explosion.x = sprite.x;
        explosion.y = sprite.y - 30;
        explosion.visible = true;
        explosion.animations.play('EXPL');
        bullet.kill();
    },

I think that this is bug. Anyway I avoided it the other way (I set limit for health to not to drop below minimal level)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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