Walk behind top of the walls like Crystalis.

Post Reply
User avatar
Gregg Richardson
Posts: 27
Joined: Sun May 27, 2018 6:16 pm

Walk behind top of the walls like Crystalis.

Post by Gregg Richardson » Sun May 24, 2020 2:39 am

Hi, I am working on a adventure game and it is very slow progress. My player character is 24 pixel height. When my character walk up and stop by a stone wall, it looks like my character standing against the stone wall and It look prefect. Top wall using 1-solid setting. When my character walk down until stop by another stone wall, it looks like my character standing by one tile away from a stone wall. I tried top of bottom wall as 0-Walkable setting, it look like my character walking on top of the walls. I don't like this. I tried 2-Walk behind setting on top of bottom wall, I don't want my character disappeared when it touch top of the bottom walls. So I need help on the script, that allowed the character and monsters walkable to the tiles, but keep the tiles on top of them. (Character and monster's 16 out of 24 pixel hidden behind a wall) So it look like they are closer to behind a wall but still see their heads. (8 out of 24 pixel showing) I am sure I seen that from Crystalis. If the script is too complex coding, I can set bottom of the wall 1 solid setting and move on. Thanks.
User avatar
jorotroid
Posts: 260
Joined: Wed Aug 08, 2018 7:48 pm
Location: California
Contact:

Re: Walk behind top of the walls like Crystalis.

Post by jorotroid » Sun May 24, 2020 5:59 am

It is a somewhat complex thing to do and would require some coding. Off the top of my head, I know that Silver Island had some sprites that went behind the background so you could try searching the forums to see if the creator of that game wrote up anything on how he did it.

That said, here is some general info on how it would work. Sprites have a bit that tells the PPU to either draw it behind or in front of the background. When behind the background, sprites will be covered up by all background pixels that are not the main background color. What you would need to do is have some way of telling when a sprite is going behind something to flip that bit, and then flip it again when the sprite comes out from behind it so your character doesn't look like it behind everything from then on. If your general ground tiles are just the main background color, they you can probably get away with making your entire metasprite go behind the background. But if you have any detail on your background tiles, then you will need to write code to specifically flip the background bit on just the sprites of your metasprite that will be going behind the background. Going with more detailed background tiles would probably make it unavoidable to have some graphical glitches of either part of your sprite appearing behind background ground tiles or partially in front of wall tiles at times.
User avatar
Gregg Richardson
Posts: 27
Joined: Sun May 27, 2018 6:16 pm

Re: Walk behind top of the walls like Crystalis.

Post by Gregg Richardson » Sun May 31, 2020 3:26 pm

I played Silver Island until I saw there was a tree that both of the player and monsters walk behind the tree trunk. This is exactly what I need to find a script coding for my main character and monsters walk behind the walls. Thanks jorotroid! I will talk to creator of Silver Island.
Post Reply