How do I set a variable with the set animation to choose

  • Hello

    I have a sprite with 3 animations where I put the letters Y, E and S

    I create a random letter every 2 seconds with

    set animation to choose("O","U","I") (play for beginning)

    Then I make it fall and I have another sprite that must recover it to constitute the word yes to earn points

    I created a variable instance for the sprite of letters but I do not know how to store the return of the function to choose to say that it was letter

    Thank you for your help

  • So you have "LetterSprite" with instance variable "letter" (which stores Y, E, S).

    To create random letters you have something like this:

    Repeat 10 times

    Create LetterSprite

    LetterSprite set letter=choose("Y","E","S")

    LetterSprite set animation to self.letter

    And you have, say "ResultSprite" that somehow recovers falling letters.

    Create instance variable ResultSprite.word

    Each time ResultSprite recovers a letter, set:

    ResultSprite.word=ResultSprite.word & LetterSprite.letter

    Once 3 letters are recovered, check if:

    ResultSprite.word="YES"

    I hope I understood you correctly, if not could you share your capx?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thx a lot , very nice solution !

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