I have an image sheet with 16 total images on it. 8 of those images are for a walk animation and the other 8 are for an attack animation.
I have the basic code as follows to introduce the image sheet
BlairSheetOptions = { width = 142, height = 190, numFrames = 16} Blair\_Sheet = graphics.newImageSheet( "Images/Blair Char Sheet1.png", BlairSheetOptions ) Blair\_Sequence\_Data = { {name = "walk", sheet = Blair\_Sheet, frames = {1,3,5,7,9,11,13,15,}, time = 1000, loopcount = 0, loopDirection = "forward"}, {name = "attack", sheet = Blair\_Sheet, frames = {2,4,6,8,10,12,14,16,}, time = 1000, loopcount = 0, loopDirection = "forward"}, }
following the API I have read that in order for me to switch between the walk animation and attack animation, I must call object:setSequence(“name”).
so for my code I call self:setSequence(“attack”) when the character is attacking and self:setSequence(“walk”) when they are to be moving.
I have noticed though, “walk” seems to be the default animation because it is the first sequence. if I were to just call self:play() without declaring a sequence, it defaults to “walk”
and when I call self:setSequence(“attack”) everything seems to work fine and the animation sequence then switches over.
The issue is when the character stops attacking and I need them to move again… I call self:setSequence(“walk”), but nothing seems to happen, the animation will stop on a single frame and basically end.
Is there an issue with setting a sequence to the first of the table? or am I going about it all wrong?