How do I change opacity of object UID?

Get help using Construct 2

Post » Thu Apr 09, 2015 2:43 pm

Hi,
I have several same type objects. I want to change the opacity of just one of them.
I was thinking about the UID of the objects but I can't figure it out the expresion for it.

Something like this:
On SpriteX collision with SpriteY then Change Opacity of SpriteZ UID=10 to 100

Possible?

Thanks! :shock:
B
5
S
1
Posts: 42
Reputation: 471

Post » Thu Apr 09, 2015 2:54 pm

Giving the object an instance variable and only changing the one with that variable would work..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Apr 09, 2015 3:34 pm

How do i change just one?

I've tried but all objects changes.

I've attached my events
Image
B
5
S
1
Posts: 42
Reputation: 471

Post » Thu Apr 09, 2015 4:46 pm

Are you trying to do something like this ?

https://dl.dropboxusercontent.com/u/700 ... ickup.capx
B
62
S
26
G
24
Posts: 954
Reputation: 18,318

Post » Thu Apr 09, 2015 5:06 pm

edit: ok after looking back over your original question....

Your screen shot works the way you have it setup, i got confused with there being 2 different Heart shaped sprites with different names in there.

If you want to use the UID method you can, you just need to add the "picking" of the UID in a separate action line in order to target it as the one you want to change its opacity of.

eg: On Sprite X Collision with SpriteY ->
(sub event) SpriteZ.UID = (which ever UID you want to target) -> set opacity to 100

By adding the "spriteZ.UID =" to a new sub event, you are telling which object for construct to find an make actions to.

The more confusing part though is the way you might be going about trying to find an object to change its value of.

Normally you would want to save the UID of the object you collided with , not the UID of a completely different object (SpriteZ).

If sprite Z is just a healhbar or or something, then simply refer to it directly instead.

eg: On Sprite X collision with Sprite Y -> add 1 to hearthbar

You seem to be trying to change opacity of random other objects instead of one specific one.
B
78
S
36
G
13
Posts: 955
Reputation: 15,260

Post » Thu Apr 09, 2015 6:44 pm

Thanks for the help!! It works!
I wanted to do exactly as the .capx from Magistross.

Thanks!! :D
B
5
S
1
Posts: 42
Reputation: 471

Post » Thu Apr 09, 2015 7:47 pm

Praised be my insightfulness ! ;)
B
62
S
26
G
24
Posts: 954
Reputation: 18,318


Return to How do I....?

Who is online

Users browsing this forum: ankas, mekonbekon and 15 guests