Spriteloq (Sprite Sheets) vs MovieClips Performance and FrameRate

Hello guys,

I need advice about the best exercises for better performance with animated objects.

Which is better, using Sprite Sheets (SpriteLoq), or using MovieClips (the movieclip.lua library)? Are there any situations when one is better than the other and so on?

Also, is there a way to manipulate the frameRate of a certain animation during runtime?

Thanks! [import]uid: 91771 topic_id: 20865 reply_id: 320865[/import]

Hi suleimanbakhit,

I’m the creator of Spriteloq. Spriteloq is built on top of the Corona’s sprite API. With it you get all the performance benefits of not having to go through lua to animate your sprites. I don’t have much experience with MovieClips other than playing around with the Corona demo. But looking at the code I can already tell it’s definitely not as efficient as going with sprites.

First off your directory is going to be filled with individual pngs of the frames your sprites. In the movieclip code, there’s event listener for enterframe to animate the sprites. You’ll need to have one of these per movieclip. There’s logic to control when the frame advances. Visibility of the frames are being toggled on and off. This is overhead you don’t need if you care about performance.

If you were to use setFillColor you would need to modify every graphic/frame with that call. The dragMe code uses direct property acces which is slow. It should used the translate function for better performance.

With sprites you can set the timeScale property http://developer.anscamobile.com/reference/index/spriteinstancetimescale

With Spriteloq you call the timeScale method on the SpriteGroup
http://www.loqheart.com/spriteloq/apidocs/files/loq_sprite-lua.html#SpriteGroup.timeScale

But with Spriteloq you can use the Include Reverse option to play a sprite in reverse.
http://screencast.com/t/t0qHc3GLH

With Spriteloq SpriteGroups, you call play(‘ninja run’) and if you check Include Reverse then play(‘ninja run reverse’) is available.

There’s a lot more that Spriteloq can do. I encourage to check out the trial, videos, API docs, and the forum http://developer.anscamobile.com/forums/spriteloq-flash-corona®-exporter.

There are quite a few of examples of Spriteloq in use on the app store as well: Cannon Cat Lite by Loqheart, Jet Rats by Jadynut games, Noah’s Memory Match from Elevate Entertainment, etc. [import]uid: 27183 topic_id: 20865 reply_id: 82266[/import]

Thanks a million Don,

I’ve been experimenting with SpriteLoq as well, it is a great and easy to use tool :slight_smile: I was searching for a frameRate thing in there, but had no clue about the timeScale property. I’ll give it a try.

You cannot animate really large objects with spriteSheets nevertheless, right? So for example if I need to create an animation where a robot is formed by having the parts flying into the screen from different angles, I would have to program the movement instead of animating it, correct?

Please tell me if there’s a walk around for this :slight_smile:

Thanks again! [import]uid: 91771 topic_id: 20865 reply_id: 82430[/import]

Yeah large size animations would have to be done programmatically. Otherwise you’d probably run out of texture memory very quickly. Some people have written motion/timeline exporters from Flash including myself, but mine is not ready for release. http://www.youtube.com/watch?v=N1IpDR2-6a4 [import]uid: 27183 topic_id: 20865 reply_id: 82491[/import]

Thanks Don! :slight_smile: [import]uid: 91771 topic_id: 20865 reply_id: 86463[/import]

Hi I’m building an app for Ipad, I´m using spriteloq to export an animation

My animation is split into two sheets and I´m trying to join them by code but it doesn´t look soo good, can you help me?

[code]
local loqsprite = require(‘loq_sprite’)
local pista1=false
local pista2=false

local spriteFactoryPista = loqsprite.newFactory(‘tierra1_dia’)
local spriteFactoryArena = loqsprite.newFactory(‘tierra2_dia’)

local parte1 = spriteFactoryPista:newSpriteGroup()
local parte2=spriteFactoryArena:newSpriteGroup()

local function next2(self, event)
if event.phase==‘end’ then
parte2.alpha=0
–parte1:currentFrame(1)
parte1:play();
parte1.alpha=1;
end
end
local function next(self,event )

if event.phase==‘end’ then
–parte2:currentFrame(1)
parte2.alpha=1
parte2.sprite=next2;
–parte2:addEventListener(‘sprite’,parte2)
parte2:play()
parte1.alpha=0;
end
end

parte1.sprite=next;
parte1:addEventListener(‘sprite’,parte1)
parte1:play()
parte2.alpha=0

[/code] [import]uid: 82653 topic_id: 20865 reply_id: 100428[/import]