Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

can I do sprite sequence coming from two spritesheets ?
Started by edualc Apr 05 2019 04:47 PM

9 replies to this topic
texturepacker
[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

edualc

[GLOBAL: userInfoPane.html]
edualc
  • Enthusiast

  • 76 posts
  • Corona SDK

howdy,
i'm using TexturePacker for my sheets but I have problems where TP created a multipack sheet (because there were too many sprites in it)
Which is fine except 4 sprites that I need for the sequence "manWalk3" are split between two spritesheets !
Can I define my sequence somehow so it picks up the sprites from imageSheetman1 AND imageSheetman2 ?
 
I could insert some dummy sprites in TP to push them over but that's not very pretty nor efficient ! Also it's not the first time that happens, i had to manipulate other sheets to get them right. However because my game is still in development, these sprites get changed regularly, some are added, some removed etc.. 
 
Thanks !
sheetInfoman1 = require("man-mul1")
imageSheetman1 = graphics.newImageSheet("assets/man-mul1.png", sheetInfoman1:getSheet() )
sheetInfoman2 = require("man-mul2")
imageSheetman2 = graphics.newImageSheet("assets/man-mul2.png", sheetInfoman2:getSheet() )

local sequenceDatamyfish =
{     
{name="manWalk1", sheet=imageSheetman1, frames={1,2,3,4}, time=400, loopCount = 0}, 
{name="manWalk2", sheet=imageSheetman1, frames={5,6,7,8}, time=400, loopCount = 0}, 

{name="manWalk3", sheet=imageSheetman2, frames={9,10,x,x}, time=400, loopCount = 0}, 

}
 


[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

Yes... you can achieve your end goals, but not the way you want to go about it.

 

 

https://docs.coronalabs.com/guide/media/spriteAnimation/index.html

https://docs.coronalabs.com/guide/media/imageSheets/index.html

 

 

Updated response.


Edited by roaminggamer, 05 April 2019 - 07:45 PM.


[TOPIC: post.html]
#3

edualc

[GLOBAL: userInfoPane.html]
edualc
  • Enthusiast

  • 76 posts
  • Corona SDK

thanks roaminggamer, i read through these many times before posting but i just cannot find an answer to my question.

How can I create one sequence containing sprites from two different sheets ?

 

can you explain ?



[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

It doesn't need to be one sequence.  You can compose a animation from multiple sequences, effectively doing what you want.

 

There is an example of this in the docs and I'm pretty sure in the examples that come with Corona.

 

https://docs.coronalabs.com/api/library/display/newSprite.html#multiple-sequences

https://docs.coronalabs.com/api/library/display/newSprite.html#multiple-image-sheets



[TOPIC: post.html]
#5

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

You can use the sprite listener to switch sequences as needed responsive to an event.



[TOPIC: post.html]
#6

edualc

[GLOBAL: userInfoPane.html]
edualc
  • Enthusiast

  • 76 posts
  • Corona SDK

Yes i can have a onComplete and start a new sequence and at the end of the second sequence i have to switch it back .. but it's rather cumbersome hence my question. (*) 

So the answer is "No you can't do it in one sequence" ? am I correct ?

 

Alternatively is there a way in TP to force multi-pack to export a group of sprites into one sheet ? (assuming this group fits in one sheet)

 

 

(*) especially for sheets that change often - today I may have 1 sprite out of 3 into the second sheet but tomorrow the 3 of them will be in the same sheet because i may have inserted two other sprites before.. 



[TOPIC: post.html]
#7

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

It is what it is.  I answered the thrust of the question.  

 

You cannot write code in the way you wanted to.  Corona does not have a mechanic that operates that way.

 

I believe however, that you can achieve your end goal for the behavior of the animation.

 

I can't answer specific questions about Texture Packer.  Also, I don't use the multi-pack feature which makes me a bad person to ask.

 

This may sound dumb, but I'd focus less on the solution I want and focus more on the behavior I want.

 

re: the last paragraph, When you say 'sprite' do you mean texture/image?  These terms get conflated and it makes these discussions a little hard to have.

 

Short-circuiting any side discussions about sprites, textures, and images.  

1. I understand when you way sprite and I say image and someone else says texture we all mean the same thing in this context.

 

2. I understand that you are saying you may have the same image in two different sheets, and you want to avoid that.

 

3. I draw a distinction because Corona has an object called 'sprite' so I like to reserve the use of that word for the object.  Thus I don't call images sprites, even if the intention is that they be used for an animation.


Edited by roaminggamer, 05 April 2019 - 08:19 PM.


[TOPIC: post.html]
#8

edualc

[GLOBAL: userInfoPane.html]
edualc
  • Enthusiast

  • 76 posts
  • Corona SDK

OK not good news but if it has to be done the hard way, it will be !  darn ;-)

 

yes 'sprite' I guess as in 'texture' , but because TP calls them sprites .. as in the buttons 'Add sprites' and 'Remove sprites' 

 

But thanks for your all your answers !



[TOPIC: post.html]
#9

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

Here is what I would do.

 

1. Only create single sheets.  When textures over-flow, put them in a new sheet.  Do not use multi-pack.

 

2. Manually write your own sequence code and use the separate sheets in a single sequence as documented here:

https://docs.coronalabs.com/api/library/display/newSprite.html#multiple-image-sheets


Edited by roaminggamer, 05 April 2019 - 08:20 PM.


[TOPIC: post.html]
#10

edualc

[GLOBAL: userInfoPane.html]
edualc
  • Enthusiast

  • 76 posts
  • Corona SDK

yep, that's pretty much what i do except I try to have one sheet per character.

Because there is the Illustrator file with its layers producing png files for each image, then they go into TP creating the sheets, so the more simple the process is the better..

So by using multi-pack at least all my png for that character are in the same place.

But I see your point . .




[topic_controls]
[/topic_controls]