Jump to content

inCamera and Respawn out camera


i3Designer
 Share

Recommended Posts

I can not do that when the enemy is in the Camera then audio.play. 
I create a group that creates a sprite every two seconds. This sprite appears random in the world (1920x1080 - view: 800: 600) this sprite always follows the main character. I want to do that when the sprite (enemy) is in the camera then part of the sound. 
code:
 
  this.enemyGruppo.forEach(function(enemy){
            game.physics.arcade.moveToObject(enemy, {x: this.marco.x, y:this.marco.y}, 100, this);
if(enemy.inCamera){
this.go.play():
}
        },this);

 

I would like to do the X and Y position is not random, but outside the Camera.

 

            this.fabio = this.fabioGruppo.create(game.world.randomX,game.world.randomY,'Fabio');

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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