How to select a group of sprite from a family ?

Get help using Construct 2

Post » Tue Oct 11, 2016 12:02 pm

Hello,
I have 10 different sprites in a family, I have created 2 family instance variables called "Life" and "Attack".
So the 10 sprites (blue,yellow...) have those family variables.

I would like to do something like this :
When a sprite from the family is on collision with the blue sprite (wich is in the family) , substract from their "Life" the attack of my blue sprite.
---> I don't want that the blue sprite (in the family) lose it's "Life" when it is on collision with an other blue sprite. So I want to select a group of sprite among the family (every sprite but not the blue one).

Hope you will understand, otherwise I will put a picture of my program.
Thanks.
B
13
S
3
Posts: 32
Reputation: 847

Post » Tue Oct 11, 2016 12:56 pm

I'll just assume that you aren't talking about 10 instances of one Sprite but about 10 truly different sprites.

It'd be easier if you had only one Sprite and 10 instances of that. But I don't know what your project is like so I'll just go with 10 different sprites.

Check my capx: https://www.dropbox.com/s/yzv62sremd7vv7i/CollisionFamily.capx?dl=1

(Just drag and drop every Sprite you want except the Blue Main Sprite)
_____________________________

EDIT: To answer you original question "How to select a group of Sprites from a family?":
Just put an event or a condition before the actions to filter the Sprites you want to apply the action to.
Every Sprite for which the conditions are true gets selected and the following actions are only applied to those Sprites.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091


Return to How do I....?

Who is online

Users browsing this forum: Bootfit, grigrizljac, korbaach and 21 guests