Hey!
I took a look at your test case, thanks for providing one!
What I’m seeing is the following:
For Issue_1, the width and height property values are set during sprite object creation but do not determine its actual size; these values come from sheetData, and the values on this data is what determine its size (the width and height properties are probably just reflecting these values, same scenario as a polygon object). Thus, calling newS:play() will redraw the object according to sheetData. Optionally, sheetContent[Width,Height] is provided in the sheetData for us to resize (scale) the sprite accodrindly.
Whether width and height properties should work the same as a rectangle object is something that I would leave at the dev’s hands, otherwise, using scale property or function call would be the proper way to “resize” the sprite without recreating the sprite object with a different set of sheetData values.
For Issue_2, you’re setting the frame and in the same code block you’re calling newS:play() which will essentially continue to play the rest of the frames and end on the last frame of the sequence (in this case frame 8). Also, doing it in the following order (just in case) will no work:
newS:play()
newS:setFrame(2)
In the code above, play is called and immediately setFrame(2) before the play sequence has ended, and thus the sprite object will end its animation displaying the last frame of the sequence. To set the sprite at a specific frame after playing a sequence you will probably want to use a sprite listener and set the frame when the “ended” phase of the sprite event has triggered:
-- add the event listener to the sprite object
local function spriteListener( event )
if event.phase == "ended" then
newS:setFrame(2)
end
end
-- Add sprite listener
newS:addEventListener( "sprite", spriteListener )
More on sprite events here.