How do I

Get help using Construct 2

Post » Sun Apr 20, 2014 12:47 pm

Hi,
I'm having problems with adressing enemies in a family. Generally applying damage to members doesn't seem too work correctly, can someone give me a general idea what the correct approach is, to reference an individual in the family?

I'm defining damage on collision per family and have my individual enemy types react to it differently, but i always get an individual per type not reacting correctly. How should i reference them correctly?

Example:
The 'enemies' family has a 'damage' variable. When hit I add to its damage.
1_familyHit.PNG


As each member type has different 'health' values, each member should compare the damage they took against their own health.
2_memberDeath.PNG


Isn't this how it should work?
You do not have the required permissions to view the files attached to this post.
B
12
S
5
Posts: 207
Reputation: 1,672

Post » Sun Apr 20, 2014 12:53 pm

That wont work correctly, "Bot" and "Enemies" are two different objects, even though "Bot" is part of "Enemies", it doesn't know what "Enemies" you are talking about in the second screenshot. If you change all "Bot" to "Enemies" in screenshot 2 it should work.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Sun Apr 20, 2014 12:59 pm

Problem then is, I need to check against the bot type's health as it's different for other enemy types.
If I change it to 'enemies' how do i make sure everyone in the family compares it to their specific health?
Last edited by facecrime on Sun Apr 20, 2014 12:59 pm, edited 1 time in total.
B
12
S
5
Posts: 207
Reputation: 1,672

Post » Sun Apr 20, 2014 12:59 pm

Try this:
First make the event in the second image a sub event to "On collision with the bullet" event. Change Bot to Enemies. Your health Value should be Family Variable and not Instance Variable. You still will be able to set it for different types of instances the way you want it, at spawn, or in the editor for example. But if you're checking for collisions with enemies, you got to keep it this way.

And for future reference, if you want to pick specific instance, what you do is: Pick Instance BOT by UID = Enemies.UiD ( If On Enemies Collision with an object for example, in your case)

Hope that helps!
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
20
Posts: 1,962
Reputation: 18,651


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests