find out what object of a family is Active

Get help using Construct 2

Post » Fri Mar 16, 2012 1:02 pm

Hello,

Im wondering how can i find out what Object from the family is "active"?

is there a function that can retrieve "object_name"?

Thank you
B
28
S
2
Posts: 69
Reputation: 1,491

Post » Fri Mar 16, 2012 2:27 pm

What does "Active" means?Yann2012-03-16 14:27:32
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Mar 16, 2012 3:05 pm

I mean for example,

Familie1 contains x amount of objects:


ObjectA (not in family) collides with familie1

Active would be the object from family1 that objectA colided with....



B
28
S
2
Posts: 69
Reputation: 1,491

Post » Fri Mar 16, 2012 3:50 pm

If you do something like
[code]ObjectA: On collision with family1
-> family1: destroy[/code]
The only object that will be destroyed it the object in family1 that collides with ObjectA

Condition does picking.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Mar 16, 2012 4:05 pm

Ok so in my code i have like x amount of Objects in a family

On colision event the following code is exactly the same for all x objects however with 1 diference

Each object has an amount of points that it adds to score

My question is how do i pass the correct score?

i dont know if this makes any sence to you, if not i will post the events when i get home....


B
28
S
2
Posts: 69
Reputation: 1,491

Post » Fri Mar 16, 2012 4:42 pm

Add a family variable called 'point' which hold the amount of point for each object in the family and then
[code]Global number score = 0
ObjectA: On collision with family1
-> System: add family1.point to score
-> family1: destroy[/code]Yann2012-03-17 13:07:08
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Mar 17, 2012 11:34 am

Lets try again :)


Family1 contains:

Enemy1 (add 20 points on kill)
enemy2 (add 10 points on kill)
Enemyx (add x points on kill)


what im asking is a way where i can do 1 collision event instead of 1 for each of my enemies..

but if i do Collision with Family1 how do i know what point amount to pass to score?


What you suggest is to divide enemies in categories per families like

family1 (20 points) family2 (10 points)

However this does not work since i only have 1 object per score but several scores..

Hope its clear now, sorry if its complicated :)


B
28
S
2
Posts: 69
Reputation: 1,491

Post » Sat Mar 17, 2012 1:06 pm

no you didn't understand my point so I think I'll make a capx 'cause we will run in circle.


Hop! familyOfEnemies.capx
Last edited by Yann on Sun Sep 14, 2014 9:19 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Mar 17, 2012 5:59 pm

thank you!

I did not see that every object gains a variable from the family..

B
28
S
2
Posts: 69
Reputation: 1,491


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests