One suggestion I have with the new Sprite API (which was also lacking in the original) is a read/write parameter for the “direction” of the animation sequence. Perhaps this API would return “1? when going forward or “-1? when going backward.
An example of this usage is this:
Let’s say I have a series of 10 player ‘walking’ frames, and another sequence of ‘walkingWithSword’ frames. I absolutely don’t want to attach or append a separate sword image on top of the player and move/track it along with the player… that’s tedious and unreliable IMHO. I would much rather have a new sequence with a sword added (graphically) that MESHES with the previous sequence, i.e. the leg/arm animations stay in proper sequential order when the sequence is switched.
I understand it’s easy to read then set the current frame when switching animation sequences, like this:
- read current frame from ‘walking’ sequence… it’s frame 6, for example
- change sequence to ‘walkingWithSword’
- force-set this new sequence to begin animating at frame 6, so the animation “meshes”
But, this only works if the sequence is going “forward”! Unless this has been changed in the new API, any new sequence starts playing in a *forward direction*, even if it’s a “bounce” sequence.
Consider a ‘walking’ sequence in “BOUNCE” looping order, instead of a forward loop:
‘walking’: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 … 9, 8, 7, 6,
--app changes animation at frame 6 on the \*backwards\* bounce progression
‘walkingWithSword’ = 6, 7, 8, 9, 10 … 9, 8, 7, 6, 5, 4, 3, 2, 1 … 2, 3, 4
OOPS! The new sequence, ‘walkingWithSword’ begins at frame 6, but it’s going in the wrong direction! Instead of logically progressing back to frame 1, it starts the new sequence in a *forward* direction, incorrectly returning to frame 10 before the bounce-back happens.
Thus, a simple (hopefully simple for Ansca) addition of “spriteObject.sequenceDirection”
would solve the problem nicely. Upon sequence change, we could read the direction of a “bounce” cycle, similar to reading the current frame, then SET that direction on the new sequence so the animation meshes perfectly. This could even be done internally and automatically, but I think some users might not prefer this behavior and thus it should be optional.
Sincerely,
Brent Sorrentino
[import]uid: 9747 topic_id: 22994 reply_id: 322994[/import]