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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...