How to select a group of sprite from a family ?

0 favourites
  • 2 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)