Jump to content

Group Follows an Object


i3Designer
 Share

Recommended Posts

I created a group of enemy and I want that this group follows an object.
I created a group in function create:
 
        this.gruppo = game.add.group();
        for ( var i = 0; i <= 10; i++ ) {
            this.sprite = this.gruppo.create(game.world.randomX,game.world.randomY,'Paolo');
            game.physics.enable(this.sprite,Phaser.Physics.ARCADE);    
        }
        this.gruppo.setAll('body.collideWorldBounds',true);

 

 

I use this for only sprite
        game.physics.arcade.moveToObject(this.sprite, {x: this.oggetto.x, y:this.oggetto.y}, 100, this);

 

but I want to do that all the sprites in the group follow an object.

I tried several solutions, but I can not.

Link to comment
Share on other sites

  • 1 year later...
 Share

  • Recently Browsing   0 members

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