The main character was created with a sprite sheet and needs to be set up to view the animation it provides. Other display images that will make an appearance include a cracked egg when a collision to a physical object has been made.
Create a new local function called
createChar()
.local createChar = function()
Create the sprite sheet for the main character.
local characterSheet = sprite.newSpriteSheet ( "charSprite.png",128, 128 ) local spriteSet = sprite.newSpriteSet(characterSheet, 1, 4) sprite.add( spriteSet, "move", 1, 4, 400, 0 ) charObject = sprite.newSprite( spriteSet ) charObject:prepare("move") charObject:play()
Set the starting position and physical properties for the main character.
charObject.x = 240; charObject.y = 250 physics.addBody( charObject, "static", { density=1.0, bounce=0.4, friction=0.15, shape=panShape } ) charObject.rotation = 0 charObject.isHit = false...