Jump to content

Group


Rafaelx
 Share

Recommended Posts

Trying to create a group, but keeps saying it is undefined got any suggestions? Please see code below.

 

this is defined in the create function:

 this.bloqueCG = this.game.physics.p2.createCollisionGroup();
 



makeOneBloque: function(){
        
        this.bloque = this.game.add.group();       
        this.bloque.enableBody = true;
        this.bloque.physicsBodyType = Phaser.Physics.P2JS;
        
        this.bloque.create(200, 950, 'Blokes');  
        this.bloque.create(550, 950, 'Blokes'); 
        this.bloque.create(900, 950, 'Blokes'); 

        this.bloque.body.setCollisionGroup(this.bloqueCG); <<<<----I get error here :(
        this.bloque.body.collides(this.bulletCG, this.hitBloke, this);
        this.bloque.body.kinematic = true; 
        this.bloque.setAll('anchor.x', 0.5);
        this.bloque.setAll('anchor.y', 0.5);
        this.bloque.setAll('outOfBoundsKill', true);
        this.bloque.setAll('checkWorldBounds', true); 


    },

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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