Select Sprite for visibility from code

0 favourites
  • 6 posts
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • I'm sure this has already been answered somewhere in the forums, but I can't seem to find an answer that makes sense. I'm new to Construct 2 and coming from using Flash, so I might not be thinking about this the right way.

    The project is to build a simple Hangman game, so no enemies, or collision, just logic.

    I have a function that creates the letters of the word from XML data as invisible sprites and places them in a line an the stage. Easy enough. Then as the user selects letters if the letter exists in the string, it reveals that letter.

    If I were doing this in Flash I would create an array and put the letter sprites in that array. Then I loop through a find(string) and use the return to make that position in the array visible.

    It's that last step that I can't figure out. I don't know how to use the find return to target a specific sprite to reveal that letter.

    dl.dropboxusercontent.com/u/16604965/HangMan.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anyone.. please. <img src="smileys/smiley19.gif" border="0" align="middle" />

  • (click for full size)

  • Thank you. I see how you set the value in the instance and then check that value against the function param. I assume that means that when the program gets to step 9, that it checks all the instances of LetterDisplay. I think that's the part I'm having trouble conceptualizing. In Flash you have to target an instance specifically with dot syntax.

  • Yeah, C2 always check all instances and pick only the ones that met the condition.

    Btw, on this forum, type "@my name" (eg: 7Soul) so I get a notification that you replied to me

  • Will do. Thanks for the help. I feel like a displaced refugee of the Apple and Adobe Flash wars. I hope Construct 2 can become my new home.

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