ID:156880
 
Is it possible to make an object.. have more then one part.. and when moved, both the parts move. My game has telekinesis and I want the players to be able to move larger objects. I have seen this done with mobs, but not sure how it would work for objects. If someone could help, I would really appreciate it.
Jackadelic wrote:
Is it possible to make an object.. have more then one part.. and when moved, both the parts move.

Yes. If you would like to see more on this, try a forum search for "multi tile object" That would probably dredge up a lot of similar questions. Also, look for the BigAtom library by Shadowdarke, as that's exactly what the library is for.

My game has telekinesis and I want the players to be able to move larger objects. I have seen this done with mobs, but not sure how it would work for objects. If someone could help, I would really appreciate it.

It would work in exactly the same way for an obj as it would for a mob.

Look up the BigAtom library. You could probably just use that.

If you want some explanation as to how it's done, the simple way is to just use an overlay with a pixel offset.
obj/tallObject
New()
var/image/head = image('icon.dmi', src, "icon state")
head.pixel_y = 32
overlays.Add(head)

If you want the effect to be more than just visual, you have to do more work. The above is a visual effect only; the "head" part of the object will not block other objects from entering the space it appears to occupy, and it will not block the tallObject from moving into a place where its head would appear not to fit.

Again, the library handles this, but if you want some further explanation...

You can simulate the object taking up more space in a couple of different ways. You could actually create more "parts" to the object and move them around with the base part of the object, or you could modify the movement functions to handle this without having extra objects by calling Enter()/Exit()/etc. on all the appropriate tiles. I would prefer the latter, as it seems to me a waste to have the overhead of the extra objects hanging around.
In response to Loduwijk
Thank you soo much! I didn't even know what to search! :P