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.

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.