Here’s a working example:-
main.lua
director = require "director"
display.setStatusBar( display.HiddenStatusBar )
local mainGroup = display.newGroup()
mainGroup:insert(director.directorView)
director:changeScene("scene1")
scene1.lua
[code]
module(…, package.seeall)
require “sprite”
local localGroup = display.newGroup()
function new()
local sheet1 = sprite.newSpriteSheet( “runningcat.png”, 512, 256 )
local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 8)
sprite.add( spriteSet1, “cat”, 1, 8, 1000, 0 ) – play 8 frames every 1000 ms
local instance1 = sprite.newSprite( spriteSet1 )
instance1.x = display.contentWidth / 2
instance1.y = display.contentHeight / 2
instance1.xScale = .5
instance1.yScale = .5
instance1:prepare(“cat”)
instance1:play()
return localGroup
end
[/code] [import]uid: 8366 topic_id: 7453 reply_id: 26437[/import]