Giter Site home page Giter Site logo

Comments (7)

benjamin-kirkbride avatar benjamin-kirkbride commented on June 23, 2024

I see that you have added a pull request with some work regarding this, the issue is that I think that a more broad solution is required, as "hitboxes" are really just objects that can be used in other contexts, and also can have properties, a template, a type, opacity, etc.

As such, I have implemented a "TiledObject" class that all of them can inherit from.

@attr.s(auto_attribs=True, kw_only=True)
class TiledObject:
    """
    TiledObject object.

    See:
        https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#object

    Args:
        :id_ (int): Unique ID of the object. Each object that is placed on a
            map gets a unique id. Even if an object was deleted, no object
            gets the same ID.
        :gid (Optional[int]): Global tiled object ID
        :location (OrderedPair): The location of the object in pixels.
        :size (Size): The width of the object in pixels
            (default: (0, 0)).
        :rotation (int): The rotation of the object in degrees clockwise
            (default: 0).
        :opacity (int): The opacity of the object. (default: 255)
        :name (Optional[str]): The name of the object.
        :type (Optional[str]): The type of the object.
        :properties (Properties): The properties of the TiledObject.
        :template Optional[Template]: A reference to a Template object FIXME
    """

    id_: int
    gid: Optional[int] = None

    location: OrderedPair
    size: Size = Size(0, 0)
    rotation: int = 0
    opacity: float = 1

    name: Optional[str] = None
    type: Optional[str] = None

    properties: Optional[Properties] = None
    template: Optional[Template] = None

I am going to move in this direction, hopefully it will work out.

from pytiled_parser.

pvcraven avatar pvcraven commented on June 23, 2024

So...where are they stored now?

from pytiled_parser.

pvcraven avatar pvcraven commented on June 23, 2024

I'm confused about the intent here. But we don't seem to be storing the hitboxes anywhere right now, correct?

from pytiled_parser.

benjamin-kirkbride avatar benjamin-kirkbride commented on June 23, 2024

from pytiled_parser.

pvcraven avatar pvcraven commented on June 23, 2024

Ok, so the updated PR should do a better job.

from pytiled_parser.

benjamin-kirkbride avatar benjamin-kirkbride commented on June 23, 2024

I am currently doing a major re-work of this, as object parsing is done in two places right now and really should be cleaned up and consolidated

from pytiled_parser.

Cleptomania avatar Cleptomania commented on June 23, 2024

The new v1.0.0 JSON re-write has 100% coverage of all Tiled object types for this.

from pytiled_parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.