Perform action for particular instance of a Sprite

Get help using Construct 2

Post » Thu Mar 30, 2017 7:14 pm

Hello! Id like to make something like this. If Textbox.Text = Sprite.InstanceVariable, set Sprite Visible. But, I dont understand how to make it so that it only sets the particular instance of the sprite that has its instance variable = Textbox.Text. I can only make it work on all instances of that sprite, not the one in particular that has an instance variable equal to the user input.

Id really appreciate any help here.
Regards,
KreKre
B
3
Posts: 10
Reputation: 195

Post » Thu Mar 30, 2017 7:37 pm

Use the System condition "Pick by evaluate".

  • In the object field, choose your Sprite
  • In the evaluate text field, enter Textbox.Text = Sprite.InstanceVariable

This should get you going.
If not, please send a screenshot of your Pick condition and I'll figure out what's wrong.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Thu Mar 30, 2017 7:38 pm

You need to pick the correct instance you want the event to take action on by specifying it in the conditions.

In this case, your condition should be Sprite - compare instance variable - instancevariable = textbox.text.
Mistakes were made.
B
52
S
26
G
111
Posts: 1,623
Reputation: 62,667

Post » Thu Mar 30, 2017 8:05 pm

oosyrag wrote:You need to pick the correct instance you want the event to take action on by specifying it in the conditions.

In this case, your condition should be Sprite - compare instance variable - instancevariable = textbox.text.


Thanks a lot, this was perfect for my intention. :) I actually thought of doing that, but for some reason I didnt think it would work with strings :P
Im guessing that there is no way to make this non-case sensitive? Its not a massive problem, but it would be a good thing.
B
3
Posts: 10
Reputation: 195

Post » Thu Mar 30, 2017 8:24 pm

https://www.scirra.com/manual/126/system-expressions

lowercase(text)
Convert the given text to all lowercase.
Mistakes were made.
B
52
S
26
G
111
Posts: 1,623
Reputation: 62,667


Return to How do I....?

Who is online

Users browsing this forum: Armench, Kin and 22 guests