Sign in to follow this  
microspace

Group revive revives at random position

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');

Share this post


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

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.