*Resolved How do I control Family Variables

Just started using Construct 2? Post your questions here

Post » Wed Jun 25, 2014 12:00 am

What I am trying to do is control Hit Points in the Enemy Family.

I am not sure how this is done.

How can I set Hit Point for 'enemy A' to X and 'enemy B' to Y.

How can I subtract Hit Points from specific 'enemy'?

I looked at functions, but all the examples have me thoroughly confused, and I can't figure how to set up even a simple function.


Family 'bullet' on collision w/ Family 'enemy' --> Family 'enemy' Hit Points -1
*but this does -1 to all enemies not specific enemy

Also can't figure out how to set HP for different enemy types.


HELP! :o

EDIT: Codah example is perfect!
Last edited by SquareMation on Wed Jun 25, 2014 8:24 am, edited 3 times in total.
B
8
S
2
G
2
Posts: 34
Reputation: 1,707

Post » Wed Jun 25, 2014 4:52 am

I'm no expert at C2 but your question got me to experiment a little. Have a look at the capx and see if it helps at all. The thing is, you shouldn't have to think in terms of specific enemy objects most of the time as C2 does that for you. The sample has 2 enemy types, in the same family. Collide the red box with the others to see how their HitPoints instance variable changes for each instance.

It has a simple function too so you can see how they work.

family.capx
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest