Map layer predicament!

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Map layer predicament!

Post by Foxley »

For some chair maptiles I drew, I was thinking of having them be set up where someone (hero or NPC) can move onto them with the backrest of the chair showing behind them, but a character can also walk behind them and it would show overhead. Here's what they look like:

Image

Unfortunately I can't think of a good way to do this. I tried making the chair a step-on NPC that doesn't do anything, and at first it seemed to work. But moving one Y coordinate up from the chair then caused it to be on top of the hero sprite even when moving back to the same Y coordinate.

Here's a quick video I made showing what I mean (kindly ignore the fact that it's a dog pirate guy and not a chair):
https://www.youtube.com/watch?v=iIH1Ciwpelc

So, I'm a bit stuck, not sure how to accomplish this. I was trying to think of using a step-on script next to those spots on either side of behind a chair to do... something that would make it behave properly, but I'm drawing a blank. Getting the X+Y coordinates adjacent to that spot and placing an overhead tile there, something along those lines maybe? Any insights would be helpful.
User avatar
Feenicks
Metal Slime
Posts: 697
Joined: Tue Aug 10, 2010 9:23 pm
Location: ON THE AIR IN THE AIR
Contact:

Post by Feenicks »

When I did something of that nature a good while back, I had it so that walking on certain flags turned on and off certain layers. There's probably a better way to do it than how I did, though [3 layers?]
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

I see how that works, unfortunately it also causes a notable flicker when moving onto a tile that the character should be shown behind. I guess it would be possible to preempt that by having the trigger occur beside the tile instead of when the hero moves right on top of it, but that would be kind of a pain to sort out.

At this point, I think I might just make chairs solid objects and only have them occupiable during certain cutscenes, where things can be easily managed and don't have to take the player's and wandering NPCs' sprites into account.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

What if you have a map autorun script that moves all the chair NPCs up one pixel?

It wouldn't work for moving NPCs but I think for stationary chairs it might do what you want
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

Oh, would that cause them to behave more reliably in terms of whether they're drawn on top of or below the hero if they weren't at the exact same Y coordinate? I hadn't thought of that, I'm getting tired so I'll see about giving that a try tomorrow.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, it's only things that are at the same Y coordinate as each other than have uncertain ordering.

Unfortunately this sort of thing can't be done with map layers, and the solution is to use slices (or NPCs since they're drawn with slices), so I think the ability to place slices on the map ought to be built into the map editor.
Post Reply