Skip to content

Feature idea: auto-create Sprite bounds #12

@JoeStrout

Description

@JoeStrout

Right now, whenever you want a sprite that can do any sort of hit-testing, you have to (1) create a new Bounds and assign to localBounds, (2) assign its width and height (almost always from the image width and height).

It'd be nice to make life easier for the simple and common case, by automatically instantiating this localBounds as soon as you do any operation on the sprite that implies the need for one. So, as soon as you call contains, overlaps , worldBounds, corners, or setCorners; or use it as the argument to some other contains call.

When any of these things happen, if localBounds is null, then initialize it to a new Bounds set to match the current image of the sprite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions