How do I hide character sprite behind wall?

Get help using Construct 2

Post » Sun Dec 13, 2015 3:44 pm

First of all i am total newbie in game development. May be there is many topics about this but i could not find anything that i found helpfull. Everything is fine from front but when character walks behind the wall i can see him through. Is there easy way to fix this?
B
4
S
1
G
1
Posts: 6
Reputation: 821

Post » Sun Dec 13, 2015 4:23 pm

Hey @Matov hi.

Of course you can.

First solution is to make the z-index of your player lower than the walls z-index(right click to wall and sent to front or edit the z-index) .

Second solution is to make a new layer with the walls that you want your player to be behind and put above the layer that you have your player.

Cheers.
B
36
S
15
G
1
Posts: 59
Reputation: 3,441

Post » Sun Dec 13, 2015 5:09 pm

So you can only do one or another option? i mean you cant get behind a wall that you put to bottom and you cant get to front of a wall that you put to top of the layer. But i wanted to know is that possible to be invisible behind a wall and be visible in front of it? Like in old isometric 2d games
B
4
S
1
G
1
Posts: 6
Reputation: 821

Post » Sun Dec 13, 2015 5:24 pm

Matov wrote:So you can only do one or another option? i mean you cant get behind a wall that you put to bottom and you cant get to front of a wall that you put to top of the layer. But i wanted to know is that possible to be invisible behind a wall and be visible in front of it? Like in old isometric 2d games

It's quite easy.

Compare the y-component of your sprite against the wall's y-component and set the z-index accordingly.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
130
S
29
G
80
Posts: 5,286
Reputation: 56,004

Post » Sun Dec 13, 2015 6:36 pm

Hey @Matov.

Alright forget about the z-index i will just give you a straight example how to do this without the need to mess around with the z-index and the action of add another layer .But keep in mind if you are a complete newbie as you say, you have to read the manual to understand the meaning of the z-index and stuff like that.

Here you go.

http://www.filedropper.com/hidesprite


I didn't want to mess around with overlaping etc. so i just add a simple variable to the wall sprite. (Move the keyboard arrows.)

Cheers.

Edit : i just read that you need this action for isometric 2d style game.So i think @zenox98 way its "the way" to do it.
B
36
S
15
G
1
Posts: 59
Reputation: 3,441

Post » Sun Dec 13, 2015 7:17 pm

Oh, i could not open file because its 218 version while i have 216. I also tried Zenox98's way and its wonderfully works on one sprite but when i want to add family or tilemap its not working.
B
4
S
1
G
1
Posts: 6
Reputation: 821

Post » Tue Dec 15, 2015 3:56 pm

after some time i tried to create new foreground layer and started to paint tilemap on it that will hide character to create depth effect but its not an ideal solution because i had to increase collision box of walls and now its become not very realistic.
if someone has suggestion on tilemap z ordering i will be gratefull.
B
4
S
1
G
1
Posts: 6
Reputation: 821


Return to How do I....?

Who is online

Users browsing this forum: istero, liborio92 and 9 guests