Jump to content

Collison 1 out of 15


tru#_beast
 Share

Recommended Posts

Hi im having a problem where only one out of my 15 sprites in my group are colliding and I dont know how to fix this. 

collisionDetection: function(){
    

        this.game.physics.arcade.collide(this.player, enemy);
       
 },

//when they are being created

                 for(var i = 0; i< this.ENEMY_SERVICE_POOL; i++){
                    
                        
                        
                        enemy = new TGA.RunClasses.Enemy(this.game, {
                         
                        x:-20 + Math.random() * 500,
                        y:0,
                  
                        origScale:this.gameConfig.ENEMY_SCALE,
                        });
                        enemy.checkWorldBounds = true;
                        enemy.outOfBoundsKill = true;
                      
                        this.enemyPool.push(enemy);
                        console.log("kk");
                        this.gameLayer.add(enemy);
                        }
                         

 

Idk why this happens. :l

Link to comment
Share on other sites

It's not about performance but the functionality you want to achieve. You can do the collisions manually with every single enemy, or do it a lot easier with the Phaser's built in functionality with groups - from the game's point of view you're doing exactly the same.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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