Spawn more enemies with one sprite

Get help using Construct 2

Post » Thu Feb 14, 2013 10:54 am

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-
Working on "EVERBLAST"
Image
B
29
S
6
Posts: 217
Reputation: 2,779

Post » Thu Feb 14, 2013 12:55 pm

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?
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Thu Feb 14, 2013 1:22 pm

Sure you can.

Here a screenshot.



Thank you!
Working on "EVERBLAST"
Image
B
29
S
6
Posts: 217
Reputation: 2,779

Post » Thu Feb 14, 2013 6:58 pm

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.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, DemantDigitalArt, Magistross and 31 guests