Hey would you mind really quikly in simple terms explaining the code??
Main.lua
local sonicInfo = require "sonic" local sonicSheet = graphics.newImageSheet("sonic.png", sonicInfo:getSheet() ) local sonicSeqData = { {name = "explode", frames = {1,2,3,4,5}, time = 500, loopCount = 0, loopDirection = "forward"}, } -- Create sprite, play 'leftwalk' local tmp = display.newSprite( sonicSheet, sonicSeqData ) tmp.x = display.contentCenterX tmp.y = display.contentCenterY tmp.xScale = 3 tmp.yScale = 3 tmp:setSequence( "explode" ) tmp:play() display.newText( "sonic (explode)", tmp.x, tmp.y + 70, native.systemFontBold, 30 )
Sonic.lua
local SheetInfo = {} SheetInfo.sheet = { frames = { { x=1, y=1, width=20, height=20, }, { x=21, y=1, width=20, height=20, }, { x=41, y=1, width=20, height=20, }, { x=61, y=1, width=20, height=20, }, { x=81, y=1, width=20, height=20, }, }, sheetContentWidth = 100, sheetContentHeight = 21 } SheetInfo.frameIndex = { ["frame1"] = 1, ["frame2"] = 2, ["frame3"] = 3, ["frame4"] = 4, ["frame5"] = 5, } function SheetInfo:getSheet() return self.sheet; end function SheetInfo:getFrameIndex(name) return self.frameIndex[name]; end return SheetInfo
I just want a further explanation on how the mail.lua knows what sonic .lua is supposed to do and then what the function in sonic.lua do?
Thanks!!