ID:156755
 
Hello,i was wondering if there is a way to make an object behave as an overlay.

I've been trying to get better at the whole multitile icon stuff, usually i simply add overlays to it. However, i want the whole thing to be dense, not just the lower left part.

so i tryed something like this:

obj
horse
icon = 'horse.dmi'
density = 1
New()
var/obj/A = new/obj/horse2
A.loc = locate(src.x,src.y+1,src.z)
..()
horse2
icon = 'horse2.dmi'
density = 1


The problem however is having the second part, or however many parts, to follow when moving.

anyone know of any good ways of doing this?

and by this, i simply mean making movable multitile icons that are dense all the way.

Every object but the "head object", the one that everything else will be following, should be assigned an animate_movement variable of SYNC_STEPS. BYOND will do the rest for you.
In response to Ter13
assigning the SYNC_STEPS seems all fair and good, but how do i assign the objects to the "main" object?

simply changing it to SYNC_STEPS does not make it follow.
In response to Narutostory
Well that's obvious! =D

You've gotta tell the connected objects to move.

Just modify the head object's move procedure to tell every connected object to move to the proper location in reference to the head object.
In response to Ter13
figured that out, i though the SYNC_STEPS was going to do all that for me. anyways, problem solved ;P
In response to Narutostory
Good for you!

Rereading my post, I seemed to imply that the engine would do all the work for you. That was not my intent, and I apologize.

However, I would like to note something. If you are going to have a lot of these, for an advanced project, it might do to actually have your movement engine modifed in such a way to actually fake the multiple object behavior. The problem arises from bandwidth/cpu issues. It's much more efficient, and can save you some significant headaches. However, if you are using range-based verbs, faking multiple tile behavior can completely break the verbs. It can also make things like attacking etc. much more difficult. Like I said, it's advanced stuff.

(I've actually written this system about four times. Once in 2007 for RPGMaker XP (in ruby), twice in BYOND (2003 and again in 2005), and back again probably in 2002 in Megazeux (Robotic).) This is actually how most 2d gaming packages operate, BYOND doesn't support the behavior itself, but faking it is simple enough, and most of my projects actually have a fully modified control scheme and movement system. I might actually release it as a library one of these days... Seeing as I'm not really getting any use out of it, and someone really should see some benefit...

However, I would not recommend this topic for a beginner/intermediate level programmer, it's some really advanced stuff.