difference between visible/invisible & opacity 0-100

Discussion and feedback on Construct 2

Post » Mon Sep 28, 2015 4:44 am

what is difference between visible/invisible & opacity 0-100
are both do same the thing
Image
B
68
S
40
G
48
Posts: 680
Reputation: 34,066

Post » Mon Sep 28, 2015 5:53 am

setting invisible won't draw the object, but if it is set visible and has opacity set to 0, it will still draw it even though you won't see it. Setting it to invisible is better for optimizing.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Mon Sep 28, 2015 6:03 am

but when object is invisible it still alive their and works if we click over that area where invisible object is
Image
B
68
S
40
G
48
Posts: 680
Reputation: 34,066

Post » Mon Sep 28, 2015 6:17 am

The logic and collision still functions for invisible objects.

It's how I often do AoE explosion damage, by spawning an invisible sprite to test for collision.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Mon Sep 28, 2015 6:52 am

opacity is an int, visibility is a Boolean, that's a pretty major difference if you ask me.
B
10
S
3
G
1
Posts: 14
Reputation: 809

Post » Mon Sep 28, 2015 1:28 pm

hellando wrote:opacity is an int

It's a float actually :)

As mentioned, invisible objects are not actually drawn at all, which is faster than using 0 opacity. The only reason you'd ever want to set 0 opacity instead of setting the object invisible is in case you are using a WebGL shader that changes the opacity so something is visible.
Scirra Founder
B
399
S
236
G
89
Posts: 24,523
Reputation: 195,378


Return to Construct 2 General

Who is online

Users browsing this forum: digitalsoapbox and 12 guests