Rafaelx

Group

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


    },

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.