Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object Library #1326

Closed
adsilcott opened this issue Jul 28, 2016 · 6 comments
Closed

Object Library #1326

adsilcott opened this issue Jul 28, 2016 · 6 comments
Labels
feature It's a feature, not a bug.

Comments

@adsilcott
Copy link

Sorry if this is a duplicate, the closest I could find was this: #1248

Currently if I want to represent something that will be spawned into the map in code, I place a tile object, then add the properties that will tell the engine what object to spawn.

For example if I want a tree object, I place it then set up the properties. If I need a new tree object, instead of making a new one and possibly making a mistake, I find an earlier one and duplicate it. This is a problem if the tree is in a different map. Also, if the tree image takes up 3x4 tiles, then I have to pick one tile to represent it, so I don't get a visual idea of the size of the tree, unless I make a separate tilesheet for each size of object.

I'd love to be able to define a library of objects with individually set custom properties and collisions, and a way of defining their visual representation as a x by y rectangle of tiles, or as a single image, along with a way align the image with the point or shape that it represents. This would make placing objects as convenient as placing tiles.

@bjorn
Copy link
Member

bjorn commented Aug 6, 2016

You could save the images you're using as objects as separate images, and add them to an Image Collection tileset. The tiles in such a tileset don't need to be all the same size. That would solve most of your use-case, right?

along with a way align the image with the point or shape that it represents

I don't really understand this part.

@bjorn bjorn added the feature It's a feature, not a bug. label Aug 6, 2016
@adsilcott
Copy link
Author

I'm realizing that this should have been two issues. One is simply a way of storing objects that have been set up with custom properties, so we can place duplicates of those objects later by choosing them from a library.

The other is similar to the "Point" object issue opened recently, however I'd like the ability to choose an image to represent that point. This is similar to using a tile object, however the coordinates for tile objects are for the lower-left corner of the tile. This works fine for uniformed size tiles, but for arbitrary sized tiles, like from a image collection tileset as you mentioned, it's difficult to get the intended location.

For example in this image below I'm trying to line up the old man with the tile, but that's going to give me coordinates that are off. If there was an image-point object that let me set an offset for the image, that would be great. Then I could line up the man's feet with the point and know that it would spawn in the right place.
2016-08-06 3

Actually, if every object type could have an image with an offset, I could see that being very powerful. I can open that as a separate issue.

Anyway, hope that makes more sense.

@bjorn
Copy link
Member

bjorn commented Aug 6, 2016

Hmm, part of that functionality will be provided by PR #1323. By shifting the tile graphic as needed, the position of the tile object could be exactly where you'd like it to be.

Still, indeed a way to store objects somewhere for later reuse would be very welcome. Similar to the "Tile Stamps" view, but for objects. I'll leave this issue open, since that would exactly be an "Object Library". The thing is that for tile objects, the tileset is basically already a kind of library. Maybe the design is not optimal here...

@adsilcott
Copy link
Author

Thanks Bjorn! A combination of an object library and #1323 would suit my needs perfectly!

Regarding the tileset as a library, here is something that I did when I started using object tiles:
I made a tileset just for objects, then assigned the custom properties I needed to the tiles, and I expected that when I placed an object tile with them that it would have those properties. They don't of course, but an implementation similar to that expected behavior would also work for what I'm doing.

@i-ka
Copy link
Contributor

i-ka commented Mar 18, 2017

As i understand, this feature is to be able to have a library of objects that linked to each of its instance on a map (i.e. we change some property of instance it changes in library object), aren't it?
Will object library be stored in separate file or it will be a part of tmx?

@bjorn
Copy link
Member

bjorn commented Mar 21, 2017

I made a tileset just for objects, then assigned the custom properties I needed to the tiles, and I expected that when I placed an object tile with them that it would have those properties. They don't of course, but an implementation similar to that expected behavior would also work for what I'm doing.

While the properties are not copied over, now that #436 is done they are displayed in gray when you select a tile object, and you could override these properties on the object.

As i understand, this feature is to be able to have a library of objects that linked to each of its instance on a map (i.e. we change some property of instance it changes in library object), aren't it?
Will object library be stored in separate file or it will be a part of tmx?

Actually, reading the original request here and subsequent messages, it occurs to me that this task is largely already done, except for finishing #1323. The "object library" @adsilcott is asking for is then exactly an image collection tileset with custom properties set on them, especially since I recently finished #432 and #436.

So I'll close this issue in preference to one better describing what is still missing. I think that would be issue #70. Whether changes to the object template should affect all (unmodified) instances is still an open question. I think it would be interesting to see how for example Unity prefabs or Unreal Engine blueprints handle this (I haven't worked with either).

@bjorn bjorn closed this as completed Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

3 participants