-
Notifications
You must be signed in to change notification settings - Fork 20
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
Hitboxes still need work #3
Comments
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. |
So...where are they stored now? |
I'm confused about the intent here. But we don't seem to be storing the hitboxes anywhere right now, correct? |
Unfortunately that is correct.
…On Wed, Jul 17, 2019, 14:59 Paul V Craven ***@***.***> wrote:
I'm confused about the intent here. But we don't seem to be storing the
hitboxes anywhere right now, correct?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZXWBSQBYKUNPSPKFZM5T3P75TY7ANCNFSM4HP6FMRA>
.
|
Ok, so the updated PR should do a better job. |
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 |
The new v1.0.0 JSON re-write has 100% coverage of all Tiled object types for this. |
Currently, if we have a hitbox defined as a polygon:
pytiled will pull the object info, but not the polygon points.
The text was updated successfully, but these errors were encountered: