(RESOLVED) Trying to get the mail...trouble with a walk behind

Started by harmonicapress, Sat 07/12/2013 20:46:35

Previous topic - Next topic

harmonicapress

Hey guys. I'm a noob having some trouble with objects and walk behinds. I've watched the tutorial a hundred times and I'm still getting something mashed up on this one. I'm just trying to have a mailbox that I can open and grab a letter. I was able to get it to work pretty well except my character can be seen where the mailbox door is when he walks behind it. I have tried dropping in a walk behind where the object will be but then I lose my mailbox lid altogether. I know I'm just not getting some kind of priority right in the coding. Here is a look at my coding. Should there be a walk behind where I drop the objects? and how do I get my character to walk behind the objects (the mailbox door). Also I snipped images but I can't figure out a way to attach them through the forum tool panel??? It looks like it wants them posted at a web location first?



function oMailbox_Interact()
{
cSam.Walk(104, 178, eBlock, eWalkableAreas);
cSam.Say("I wonder if the Pony Express left anything today...");
oMailbox.Visible = false;
oOMailbox.Visible = true;
oLetter.Visible = true;
}

function oLetter_Look()
{
cSam.Say("Looks like I got a letter.");
}

function oLetter_Interact()
{
cSam.Walk(104, 178, eBlock, eWalkableAreas);
cSam.Say("Looks like it's from my brother J.B.");
oLetter.Visible = false;
cSam.AddInventory(iLetter);


Khris

You can implement the mailbox itself as a walkbehind or object. The mailbox door or any other movable part should be implemented as object.
The important part is the baselines though. A walkbehind has a baseline you can drag to any y-coordinate. An object by default has its baseline at its y coordinate, which is the bottom edge of the used sprite. You can move that though by using oMailboxDoor.Baseline = 120; (usually in the room's before fadein event).

The baseline determines drawing order, which determines what's going to cover what.
You need to arrange the baselines in the proper y-order.

Your mailbox walkbehind should have its baseline right where the mailbox is sticking in the ground, in between the parts of your walkable area before and behind it.
The mailbox door's baseline should be one or two pixels below that, so it will cover the mailbox itself, and also the player character when they are behind it.

     | |
     | |
     | |
     | |
#####| |#####
walka| |e area
#####| |#####
     | |
-----|-|-----  mail box walkbehind baseline
-------------  mail box door baseline

#############
walkable area
#############

Mandle

Quote from: Khris on Sun 08/12/2013 01:06:47
     | |
     | |
     | |
     | |
#####| |#####
walka| |e area
#####| |#####
     | |
-----|-|-----  mail box walkbehind baseline
-------------  mail box door baseline

#############
walkable area
#############


Man I love those old-school graphics! When do we get to play!? (laugh)

harmonicapress

YES! I had my baseline set to the lowest pixel on the object instead of below the walk behind base line!!! I Set the objects' baselines to 177 and flip! Everything lined up like clockwork! Thank you so much!!!!

SMF spam blocked by CleanTalk