Jump to content

Question: Create group of enemies that fires to one sprite that is moving


Recommended Posts

Hi, I'm new with Phaser, I'm wondering how can I create a group of enemies that appears at the side of the screen in a random Y position between 550px and 745 px, after they appear they need to start to fire to my character

Right now I have a function to create the bullets and how they will be fired:

createBullets:function(laserToFire,track,offsetX, offsetY, bulletDirection,fireRate,bulletSpeed){
        weapon = gameSP.add.weapon(10, laserToFire);
        weapon.bulletKillType = Phaser.Weapon.KILL_WORLD_BOUNDS;
        weapon.bulletSpeed = bulletSpeed;      
        weapon.fireRate = fireRate;
        weapon.trackSprite(track, offsetX, offsetY);
        weapon.fireAngle = bulletDirection;right

So what I'm looking to do is to have each one of my enemies within the group to fire to my character.

Thanks in advance.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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