i3Designer Posted September 11, 2014 Share Posted September 11, 2014 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 More sharing options...
JUL Posted September 11, 2014 Share Posted September 11, 2014 Not sure if I understand what you really want to achieve. If you want to spawn things outside of camera, then check camera.bounds.width, camera.bounds.x, etc... http://docs.phaser.io/Phaser.Camera.html#bounds Link to comment Share on other sites More sharing options...
i3Designer Posted September 12, 2014 Author Share Posted September 12, 2014 I did not understand, now I try Link to comment Share on other sites More sharing options...
Recommended Posts