Hello Guest

Author Topic: REQUEST: More controls on AttachPoints (Z-depth, complex data, callback events)  (Read 3259 times)

MindsEye

  • Newbie
  • *
  • Posts: 4
    • View Profile
Hi! I've been using 2D toolkit for quite a while with my game Blast Brawl 2 (Steam link: http://store.steampowered.com/app/447980). 2D Toolkit is GREAT, much better than current standard 2D support in unity, but I have a few requests for tweaks/additions that would be extremely useful in certain situations.

I heavily use Attach points to make game effects line up with sprites on a per-frame basis. The support that IS there is very nice, but there are a few additional features that could prove extremely useful!

1: MOST IMPORTANTLY: Pleeeease add controlled Z-depth onto the attach points.
Currently there is no good out-of-the-box way to have an AttachPoint reliably positioned above/below a sprite other than to just set the Z-depth on the transform.

There is particularly no good out-of-the-box way to have the transform move dynamically in front of and behind a sprite on a per-frame basis (e.g., as part of a sword slash animation, with the sword starting in front of the body, slashing in front of the character, and ending on the far side of the sprite).

This seems extremely simple (though I know that's always dangerous to say about someone else's codebase) but more importantly, it seems like a particularly useful and straightforward addition.

2: Add complex data to each attach point
This is more of a "nice to have," but it seems potentially quite useful to have arbitrary data associated with each AttachPoint for each sprite in a collection. A good example is how there are "events" with data in animations, but I'd suggest having more fields/flexibility (e.g., add an array of strings so that users can have tons of data/parse out anything they want at runtime).

In addition theoretical "gameplay" use cases, this is potentially useful in a pure rendering context. Consider that it allows much more information for how an attached sprite should be displayed (e.g., display the mounted "head" sprite looking to the front instead of to the right on this frame). Coupled with the Z-depth addition above, this would help solve many issues for "body part" sprites I've run into without excessive external code.

I'd also suggest adding similar data fields onto each individual Sprite Definition in general, as it has similar potential uses (particularly on Tilemaps).

2b: Add callback events to process data in "2"
Just an additional request: if the data above is added, it would be extremely helpful if callbacks were added to make processing attach point changes easier.

If I could suggest a format, adding both a general callback and mapping a callback specifically to an attach point name (i.e., only receive calls for the attach point "head" is active) would probably be useful. Also, adding callbacks for when an attach point becomes active as well as inactive would be potentially nice. (There's a theoretical use case for developers who want to manually handle "disabling" an attach point while still leaving the relevant game objects active in the scene.)



In summary: AttachPoints are extremely useful! But what is there is slightly bare-bones. These are (imo) simple, general-purpose enhancements that allow developers to leverage them in much more technical ways.
« Last Edit: April 10, 2017, 01:20:40 am by MindsEye »