Defining and Copying objects in Gleed2d

Nov 19, 2010 at 1:58 AM

As of the moment the only way I can think of to define an object is to assign the texture a name and give it several custom properties - but there's a problem when you copy this object. 

If your object is named "Monster_001", copying it should create "Monster_002" not "Texture_2352."  I think SeriousSam mentioned that he fixed this in a fork but I'm not sure I want to start using anything on a fork for production work.  I have considered downloading and modifying the source but this should be in the main development trunk.

Helpful feature 1:  A tabbed panel that allows you to store a list of user defined game objects without having to insert them into the level on a layer.  When you drag/drop your custom object into the scene, it is auto-assigned a unique ID number.  In the XML, the object will have the user-defined object type and a unique object ID.

Helpful feature 2:  Layers within layers.  Wouldn't it be useful to have a Layer called Environment, and sub layers called Trees, Bushes, Platforms, Doors, etc. ?

 

Nov 19, 2010 at 3:56 AM

In my personal fork (which is just simple tweaks specific to my game) I've been considering something like your helpful feature 1.

I'd add a tab at the bottom for "User Items" which would be presets created from other items.  Say you select a bunch of textures, then hit a button, it'll record all the settings for each of the selected textures, and then be able to recreate them all with their custom properties, scale, rotation, tint, etc. already set.  Even better, we could save these presets out to a file, so you could load them up again when you are working on a different level later. Would that work for you?

Keep in mind, that's only in my head at this point, and I'm not sure what it would take to implement. If I get put together, I'll gladly share it.

Nov 20, 2010 at 2:53 AM
Edited Nov 20, 2010 at 2:59 AM

That would probably work fine as long as you auto-generate unique IDs each time -any- object is created.  The unique ID should be of the format NNNNN where N = [0-9]

Example

1. Open new level, create a new layer

2. Create object, ID assigned is 00001

3. Create a new layer, switch to new layer

4. Create object, ID assigned is 00002

5. Grab objects 00001 and 00002, press 'Define User Item'.  You are prompted for Object name input.  This will be a custom property called ObjectType.  Set it to "MyItemType"

6. Go to User Item tab, select your new ObjectType

7. Click on level, and object 00003 is created.  It has the custom property ObjectType="MyItemType"

etc.

 

Note:  If you're going to allow selections of multiple items to become objects, you'll need to somehow count/indicate how many sub objects there are in the group.  You may want to ignore the layer information if they are on separate layers, also.  It could be a problem if when you tried to create objects, you had to inject them into the level based on layers that may or may not exist at that moment in the future.