Skip to content
This repository was archived by the owner on May 24, 2018. It is now read-only.
This repository was archived by the owner on May 24, 2018. It is now read-only.

Tilemap.hx [enhancement] pull multiple objects  #65

@smoketh

Description

@smoketh

Please consider adding this function to Tilemap.hx

/**
  * Returns all objects with matching name in a given object group
  * @param name The name of the object
  * @param inObjectGroup The object group which contains this object.
  * @return An TiledObject, null if there is no such object.
  */
public function getObjectsByName(name:String, inObjectGroup:TiledObjectGroup):Array<TiledObject>
{
    var k:Array<TiledObject> = new Array<TiledObject>();
    for(object in inObjectGroup) {
        if(object.name == name) {
            k.push(object);
        }
    }
    return k;
}

and subsequently changing getObjectByName comment to

     /**
      * Returns first object with matching name in a given object group
      * @param name The name of the object
      * @param inObjectGroup The object group which contains this object.
      * @return An TiledObject, null if there is no such object.
      */

Reasoning behind is pretty simple - a lot of times i use standardized objects within given map and just copy-paste them. Changing name for every single one of them would be stupid, to say the least.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions