Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Getting spritesheet data from sprite object
Started by richard11 Apr 01 2018 03:40 PM

1 reply to this topic
sprites animation sequence
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 473 posts
  • Corona SDK

Hoping this is possible but I can't seem to find anything in the documentation...

 

If I have a sprite created with display.newSprite() and sequence data, I can call .sequence and .frame to get the name of the sequence and the current frame pointer within that sequence, but can I instead get the filename of the image sheet it's using, and the frame pointer of that sheet?

 

For example, with an image sheet of say... 20 images, I might have 5 sequences set up, each using 4 frames from the sheet, but .frame will just give me 1-4 regardless of which sequence is playing, instead of telling me that it's frame 11 of the full sheet.

 

I could of course keep variables of this data to do a reverse lookup of the sequence and frame data I can already access, but if there's an existing method for it then I don't want to waste memory with my own mapping...

 

As usual, any help would be appreciated please.



[TOPIC: post.html]
#2

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 473 posts
  • Corona SDK

I've ended up just doing this the variable map way actually, but if there's a better approach I'd still love to hear it!




[topic_controls]
[/topic_controls]