Select Sprite for visibility from code

Get help using Construct 2

Post » Fri Jun 21, 2013 8:57 pm

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.

https://dl.dropboxusercontent.com/u/16604965/HangMan.capx
B
3
Posts: 5
Reputation: 185

Post » Sun Jun 23, 2013 1:47 am

Anyone.. please. adrelles2013-06-23 01:50:22
B
3
Posts: 5
Reputation: 185

Post » Sun Jun 23, 2013 2:11 am


(click for full size)7Soul2013-06-23 02:11:59
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Mon Jun 24, 2013 2:44 pm

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.
B
3
Posts: 5
Reputation: 185

Post » Mon Jun 24, 2013 9:35 pm

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
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Mon Jun 24, 2013 9:52 pm

@7Soul. 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.
B
3
Posts: 5
Reputation: 185


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 47 guests