Game Development Community

Need help with adventure style screen

by Stephen Howe · in Torque Game Builder · 08/04/2007 (1:51 pm) · 2 replies

Ok, this isn't anything I'm working on, just an experiment using some "stock" images I have handy (me ala simpsons & photo of hall in Hilton Anatole in Dallas, TX from QuakeCon in '06).

what I want is for my character to walk behind something when he's "behind" it & in front of it when he's "in front" of it. So, I took the part he goes "behind" & made it a separate image on a separate layer.
img218.imageshack.us/img218/575/right01ar0.th.jpg
works great as long as he's "behind" ti, but when I move down where he's "in front"...
img452.imageshack.us/img452/20/wrong01vi3.th.jpg

I remove that image & it looks good when he's in front
img329.imageshack.us/img329/2742/right02ma2.th.jpg
but when he goes behind he's overtop the image he should be behind:
img329.imageshack.us/img329/8818/wrong02hg2.th.jpg

how can I get him to be behind when it's supposed to be behind it & be infront when he's supposed to be in front of it? I know it's got to be something simple but my brain's stuck in 3d mode & can't figure it out.

#1
08/04/2007 (2:22 pm)
Put your scenery that the player can walk in front or behind in the same layer as your character sprite. For example, Layer 15.

Put anything that is always behind the character in a higher layer such as 20+ and anything that is always in front of the character in a lower layer, say 10 and below.

Next select the t2dsceneGraph in the object tree and go to the edit tab. There should be a tab further down called "Layer Management", expand it and look for layer 15. Change the drop down box for that layer from "Normal" to "Y Axis".

Now everything on layer 15 will be sorted to ensure things lower down the screen are assumed to be closer and thus rendered in front of anything higher up the screen.

There's one more step you need to do, and that's click in turn on each of the objects you've placed in layer 15 such as your character, and select the "Edit sort point" option. Move the sort point to the players feet and do the same with the other objects.

Whenever your characters sort point is below another objects sort port, he'll render in front of it, whenever it's above, he'll render behind.

You just need to setup a collision poly around the base of your objects to prevent the player from walking "through" the object, but still allowing him to walk behind it.

Hope I understood what you're trying to achieve.
#2
08/04/2007 (2:56 pm)
Ho-ho, that's perfect! :D No wonder I couldn't figure it out: there's no "layer management" info in the included 1.5 doc's. Can't find anything about it in TDN either.

Now I know what the sort points could be useful for too. Thanks twice!