How do I point out objects within families

Get help using Construct 2

Post » Sat Aug 09, 2014 1:21 pm

On screen I have: Option 1, option 2, option 3, options 4, option 5. (text objects)
When you touch option 1, I want it to have opacity 100 and the others opacity 30.
I also added square sprites on top of each text object, so that the user has more space to touch the option.

Option texts are put in family OptionsTextFamily.
Square touch sprites have been put in family OptionsTouchFamily.

What would be the efficient/elegant way?

The not elegant way is:
On touch TouchSprite1 --> set options1Text opacity to 100
set options2Text opacity too 30
set options3Text opacity too 30
set options4Text opacity too 30
set options5Text opacity too 30

On touch TouchSprite2 --> set options1Text opacity to 30
set options2Text opacity too 100
set options3Text opacity too 30
... and so on. :(
My latest game is: Plants at www.rogerty.com
B
28
S
6
G
7
Posts: 683
Reputation: 5,686

Post » Sat Aug 09, 2014 2:22 pm

Don't have time to do a capx now, but I have done a similar thing before.

First set touch sprites and options text as container of each other so they get picked together.

Local var options_uid
On Touch TouchSprite1
-> set OptionsText opacity to 100
-> system set variable options_uid to OptionsText.UID

then

System: Every Tick
/System: Pick all OptionsText
/OptionsText.UID <> options_uid
-> set OptionsText opacity to 30
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sat Aug 09, 2014 2:29 pm

rogerty wrote:What would be the efficient/elegant way?


... Don't use text object on mobiles. Instead use one spritefont and make 5 instances (one for each option)
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Sat Aug 09, 2014 5:27 pm

codah wrote:
First set touch sprites and options text as container of each other so they get picked together.


First off, thanks for the reply.

Do you mean: I select one textobject and press: add container and select a touch sprite. Then go to the next textobject and select the corresponding sprite object?
My latest game is: Plants at www.rogerty.com
B
28
S
6
G
7
Posts: 683
Reputation: 5,686

Post » Sat Aug 09, 2014 5:27 pm

shinkan wrote:
rogerty wrote:What would be the efficient/elegant way?


... Don't use text object on mobiles. Instead use one spritefont and make 5 instances (one for each option)


I will, from now on.
Text objects demand more memory?
My latest game is: Plants at www.rogerty.com
B
28
S
6
G
7
Posts: 683
Reputation: 5,686


Return to How do I....?

Who is online

Users browsing this forum: dop2000, Narus11 and 2 guests