Spawn more enemies with one sprite

0 favourites
  • 4 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • Hello folks. First of all I have to say sorry for my poor english.

    I have one sprite for an enemy. Its a bug! It has one instance variable (health).

    My Problem:

    My enemy spawns between one and five times randomly on my map.

    If I fight against this bug and the bug dies, all other bugs which also spawned on my map also die. Because they have the same name and the same instance variable which is then at 0.

    How can I bypass this? Array? Dont know about arrays.

    I just cannot find any solution for this for two days now.

    Hope u guys can help me.

    Regards

    -Kraudi-

  • If you're decreasing the instance variable correctly, it should only destroy the one you're dealing with. Can we see a capx or a screen shot of the code where you are doing the "damage" and where you destroy the bug sprite?

  • Sure you can.

    Here a screenshot.

    Thank you! <img src="smileys/smiley1.gif" border="0" align="middle">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah. I take it from the group name "Bug1" that you've got different groups for each of the bugs (you said there were 5 max total, correct?)

    The problem is that when you are decreasing the health, that event doesn't pick a specific instance of the bug sprite, so it's applying it to all of them.

    You might try adding the Sprite -> Pick nth instance to the event with the mouse click and what_is_clicked and isinfight variables to pick the 1st instance (or 2nd for second bug, etc). That will cause everything you do to the bug sprite for that event to only go to one bug.

    Would have to see all the code itself to know for sure if that will work for you, but that's where I'd start.

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