0 Favourites

How do I display sprite?

  • Okay, I got this SPRITE FAMILY and randomly SYSTEM CREATES sprites from a certain family.

    What I am to achieve is this?

    FAMILY 1 > CHAIR, TABLE, BOOK

    FAMILY 2> BLUE, BIG, NICE

    Basically SYSTEM RANDOMLY CREATES A COMBINATION FROM BOTH FAMILIES EG.:

    BLUE CHAIR

    WHEN BLUE CHAIR IS CREATED IT FALLS DOWN ACROSS SCREEN TILL IT COLLIDES WITH A SOLID THEN I SET MAX SPEED TO ZERO AND THE WORDS STAY THERE.

    I would like to display a sprite (I already have it) that corresponds to BLUE CHAIR, FOR EXAMPLE.

    So, SYSTEM CREATES BIG CHAIR I want to display BIG CHAIR. I can't seem to find a way to do that. Tried OVERLAPPING AN INVISIBLE SOLID, COLLIDING WITH A VISIBLE SOLID. I am bummed out.

    HELP!

  • kiko2015 it hard to understand how your game works at all (or how it should).

    As far i understand, you want to determin which random sprite combination was created?

    You can set a family instance variable (e.g. 'type') and countnumber each object of the family (1=chair, 2=table, 3=book, ...) and check this variable/constant.

    Better post your project (capx) to understand your question....

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • kiko2015 it hard to understand how your game works at all (or how it should).

    As far i understand, you want to determin which random sprite combination was created?

    You can set a family instance variable (e.g. 'type') and countnumber each object of the family (1=chair, 2=table, 3=book, ...) and check this variable/constant.

    Better post your project (capx) to understand your question....

    <a href="http://geocities.ws/alvoradaespirita/test/test.capx">capx</a>

  • ok i see.

    as mentioned add a family instance variable to each family

    • the instance variable for CHAIR='chair', HOUSE='house', ...
    • the instance variable for BLUE=1, BIG=2, ...

    To reduce the code you can do the following:

    Create a new sprite containing all corresponding sprites (combinations) you want to show - grouped (separate animation) by NOUN and frameindexed by ADJ.

    Name the animations by this NOUNs (CHAIR, ...) [with the first animation frame is the BLUE CHAIR, the second the BIG CHAR, ...]

    The ADJ instance variables have to correspone with the frameindex of each animation.

    Once the resulting combination is fix (all falling sprites are known), you know the instance variables of NOUN and ADJ (e.g. 'CHAIR', 1 (for blue))

    Then you create the representing sprite and set it's animation [NOUN-instancevariable = 'CHAIR'] and it's frame is [ADJ-instance variable = 1].

    I hope you understand the way it works...

  • ok i see.

    as mentioned add a family instance variable to each family

    - the instance variable for CHAIR='chair', HOUSE='house', ...

    - the instance variable for BLUE=1, BIG=2, ...

    To reduce the code you can do the following:

    Create a new sprite containing all corresponding sprites (combinations) you want to show - grouped (separate animation) by NOUN and frameindexed by ADJ.

    Name the animations by this NOUNs (CHAIR, ...) [with the first animation frame is the BLUE CHAIR, the second the BIG CHAR, ...]

    The ADJ instance variables have to correspone with the frameindex of each animation.

    Once the resulting combination is fix (all falling sprites are known), you know the instance variables of NOUN and ADJ (e.g. 'CHAIR', 1 (for blue))

    Then you create the representing sprite and set it's animation [NOUN-instancevariable = 'CHAIR'] and it's frame is [ADJ-instance variable = 1].

    I hope you understand the way it works...

    Thank you!

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