top down : realistic reveal map

Get help using Construct 2

Post » Sun Jun 23, 2013 4:30 pm

im making a top down shooter, and i would like to implement a kind of fog of war.
i would like to reveal only what can really be seen by the character.
a kind of line of sight fog of war.

so if you stand in front of an opened door,
if you are far away you can see what its in the center of the room ,
but if you want to see all the room you have to pass the door.

just like the main character is a light source and everything behind a wall is in the dark

understand what i mean ?

do you think its possible ? and ideas how to achive it ?

thanks
B
19
S
5
Posts: 104
Reputation: 1,761

Post » Sun Jun 23, 2013 4:40 pm

Hi,

see the lighting example in the examples folder
spongehammer2013-06-23 16:40:28
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Sun Jun 23, 2013 5:17 pm

@spongehammer


thanks for your answer, but if you read carefully, thats not good for what i asked.
in the exemple it does not take count of walls.

its a simple png with alpha following the player here.
what i ask seems to me far more complex.
correct me if im wrong.

B
19
S
5
Posts: 104
Reputation: 1,761

Post » Sun Jun 23, 2013 6:14 pm

http://activeden.net/item/realistic-2d-dynamic-lights-as3/686703


like this . replace the lighted area by the field of view. but thats it. thats what i would like.
B
19
S
5
Posts: 104
Reputation: 1,761

Post » Sun Jun 23, 2013 6:42 pm

Cover a layer with sprite blocks, set the visibility of any that come within 300 pixels or so of the player to invisible. Leave them that way.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Sun Jun 23, 2013 9:09 pm

I know you're worried about walls, too. You could take BluePhaze's example, but modify if a bit and have like 8 "zones" around the player. One above, one beside, one diagonal, etc all the way around. It could even be 8 invisible sprites that define how big of an area you want cleared. Then, if a black "cover" sprite comes into contact with one, set it to invisible UNLESS the visibility zone is overlapping a wall object. You would have to do some testing to get the right balance, but that should work for rooms and hallways just fine, I think.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Sun Jun 23, 2013 11:47 pm

@manukeo


See this post..

http://www.scirra.com/forum/exported-to-web-output-is-odd_topic69246_post426739.html?KW=#426739
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Mon Jun 24, 2013 11:40 am

@spongehammer very intersting post.
your solution (your capx, is very nive but im afraid about frame rate.
do you have the capX of Joannesalfa's example ?

@Bluephaze
@c-7

thanks for your advice, i think it may wirk like hat also. need to do some testing.
B
19
S
5
Posts: 104
Reputation: 1,761

Post » Mon Jun 24, 2013 3:02 pm

@manukeo

Here it is.. this is not my work. I dont know where it originated i am afraid.

Shadows
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Tue Jun 25, 2013 9:42 pm

@spongehammer   i wasnt able to fully undestand your capx, but i was able to reproduce it, but its far too heavy . nice but heavy.

the @bluephaze solution is working well and allow 60fps .
but it doesnt take count of the walls.

@Joannesalfa 's example , i cant make it work. impossible to spawn object on tiled background, and i will not make all my walls with single sprite. it will cause many toomuch sprite animated on every tick. not usable exept for very small layout i think....

it left me with maybe trying the C7 version of bluephaze example.
but i need to find a solution to tell : set invisible to the sprite who are between the player and the point where the detection sprite overlap the wall, and let the other, after the wall visible. dont know how to do that.


i hope there will be a behavior like that in the future :)    
someone know where we can consult the TO-DO list ?


anyway thanks all for your help.
B
19
S
5
Posts: 104
Reputation: 1,761

Next

Return to How do I....?

Who is online

Users browsing this forum: adventurist, Blendi1223, PROxMTswatTR, ST314 and 24 guests