Um eine Animation in Corona SDK zu erstellen, ist es am besten das Sie resource
zu verwenden, um die Animation mit diesem Code
display.setStatusBar(display.HiddenStatusBar)
-- lua data file that Texture packer published
-- it contains the data required by newImageSheet
-- and also contains a function to retrieve frames
-- by their names sheetInfo:getFrameIndex("sprite")
local sheetInfo = require("spritesheet")
-- init the image sheet
local myImageSheet = graphics.newImageSheet("spritesheet.png",
sheetInfo:getSheet())
local sequenceData = {
-- set up anmiation
{
name="walk", -- name of the animation (used with setSequence)
sheet=myImageSheet, -- the image sheet
start=sheetInfo:getFrameIndex("capguy/walk/0001"), -- name of the first frame
count=8, -- number of frames
time=1000, -- speed
loopCount=0 -- repeat
},
}
capguy = display.newSprite(myImageSheet, sequenceData)
-- set initial position and direction
capguy.x = 160
capguy.y = 300
direction = 1
-- start walking animation
capguy:setSequence("walk")
capguy:play()
Für Physik verbinden - Physics Editor