How do I make my enemies independent?

0 favourites
  • 5 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 38 enemy ship sprites to be used in your game.
  • Every time I attack my enemy, and if there's more than one in game at a time, they will all share the knockback that I put in and the direction. If one is moving left then they are all moving left. If one gets hit then they are all getting knocked back. Any chance there's a fix that doesn't involve me scrapping the entire enemy?

  • At a glance, it seems GrublinhurtRight/Left are global or local variables, so when you change them, they will apply to all the sprites. You should make them instance variables of the sprites themselves to make them affect the sprite in question only.

  • At a glance, it seems GrublinhurtRight/Left are global or local variables, so when you change them, they will apply to all the sprites. You should make them instance variables of the sprites themselves to make them affect the sprite in question only.

    Changing them to instance variables fixed the knockback problem, But they still have a hive mind when it comes to direction. I don't know why the instance variable would work for the knockback but not the direction. Any thoughts?

    Thanks for your help.

  • Not certain from what I see here, but I'll hazard a guess and say it might be to do with the 5th line on the second screenshot, the one with an LOS check and two overlap checks. Try inserting a For Each Grubhitbox after the overlaps and see if that makes a difference.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry, for the late reply. Yes that seems to have done it, thank you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)