Get help using Construct 2

### » Mon Nov 05, 2012 7:16 pm

Hi everyone,

I am having some difficulty with getting my player object (a submarine) to trigger the opacity of wall objects. The idea is that the opacity of the walls are initialized to zero so they are not visible until the player begins to move within a certain distance.

Unfortunately it seems like regardless of the distance I set, the opacity is set randomly. It could be due to there being multiple wall objects placed around the player but I am not sure.

I have attached a link to the capx but if anyone has any ideas as to how to tackle the problem in general, that would be appreciated too.

Thanks all!

B
22
S
5
G
6
Posts: 57
Reputation: 4,487

### » Mon Nov 05, 2012 8:38 pm

in your distance expression, you're multiplying wall.y by 0.1.. you'll wanna keep that outside the brackets so it's
distance()*0.1
although i think 0.5 might be more what you're after

also you should save it as a .capx file and upload that, it's the folder contents but zipped up, and can be opened by c2 directly.keepee2012-11-05 20:44:17
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

### » Mon Nov 05, 2012 9:33 pm

Doh! Thanks keepee for both the hint on my expression and how to post the capx. I'll give that a shot. :)
B
22
S
5
G
6
Posts: 57
Reputation: 4,487

### » Mon Nov 05, 2012 10:48 pm

Hmmm... I still must be doing something wrong. I updated the file in Dropbox if anyone is interested.

It seems like it is getting confused as to which instance of my wall object to calculate against as it doesn't seem to fire consistently. Sometimes you can run right into a wall and it doesn't fade into view.

B
22
S
5
G
6
Posts: 57
Reputation: 4,487

### » Mon Nov 05, 2012 11:35 pm

Problem Solved ...
Replace your last event by :
For Each | Wall :
-- Wall | Set Opacity to 100-(distance(Player.X,Player.Y, Wall.X,Wall.Y)*0.5)
B
35
S
16
G
16
Posts: 2,223
Reputation: 16,591

### » Tue Nov 06, 2012 2:06 am

Argh! Thanks Whiteclaws! I'll give that a shot as soon as I get home. That would make total sense.
B
22
S
5
G
6
Posts: 57
Reputation: 4,487