My sprite anim lags, why?

Hi,
I have a simple scene with a newRect for the grass, and a spritesheet with 4 images, the animation lags a lot, I tried to change the simulator view (iphone, ipad) but it lags.
The image is 112 Ko and the size is 112 x 41 :

Could someone try or is there something I am missing? Is it because of the simulator?

function initSprite()
    local options =
    {
        width = 28,
        height = 41,
        numFrames = 4,
        sheetContentWidth = 112,  -- width of original 1x size of entire sheet
        sheetContentHeight = 41  -- height of original 1x size of entire sheet
    }
    local imageSheet = graphics.newImageSheet( "Assets/hero.png", options )
    local sequenceData =
    {
        name="walking",
        start=1,
        count=4,
        time=500,
        loopCount = 0,   -- Optional ; default is 0 (loop indefinitely)
        loopDirection = "forward"    -- Optional ; values include "forward" or "bounce"
    }
    hero = display.newSprite( imageSheet, sequenceData )
    hero.x = display.contentCenterX
    hero.y = display.contentCenterY
    sceneGroup:insert(hero)
end

Hello Leo56765,

Welcome to the Solar2D community. Try

hero:play()

if you have not already done so. You can find a number of properties and methods of the Sprite object here,

hello
thanks for the reply
actually it does not lag on the phone, only in the simulator so I guess it’s my computer :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.