– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
physics.start()
--Movement-----------------------------------------
--Move Right--
isMovingRight = false
function enterMoveRight ( event )
--print(“Moving Right”)
if isMovingRight == true then
jensen_Character.x = jensen_Character.x + 5
jensen_Character:setSequence(“jensen_Character_right”)
jensen_Character:play()
end
end
Runtime:addEventListener( “enterFrame”, enterMoveRight )
function rightButton:touch (event)
if ( event.phase == “began” ) then
isMovingRight = true
jensen_Character.rotation = 0
elseif ( event.phase == “ended” ) then
isMovingRight = false
jensen_Character.rotation = 0
end
return true
end
rightButton:addEventListener(“touch”, rightButton)
function jensen_moveRight ()
jensen_Character:setSequence(“jensen_Character_right”)
jensen_Character:play()
end
rightButton:addEventListener(“touch”, jensen_moveRight)
--Move Left--
isMovingLeft = false
function enterMoveLeft ( event )
--print(“Moving Left”)
if isMovingLeft == true then
jensen_Character.x = jensen_Character.x - 5
jensen_Character:setSequence(“jensen_Character_left”)
jensen_Character:play()
else
jensen_Character:pause()
end
end
Runtime:addEventListener( “enterFrame”, enterMoveLeft )
function leftButton:touch (event)
if ( event.phase == “began” ) then
isMovingLeft = true
jensen_Character.rotation = 0
elseif ( event.phase == “ended” ) then
isMovingLeft = false
jensen_Character.rotation = 0
end
return true
end
leftButton:addEventListener(“touch”, leftButton)
--Move Up--
isMovingUp = false
function enterMoveUp ( event )
--print(“Moving Right”)
if isMovingUp == true then
jensen_Character.y = jensen_Character.y - 5
jensen_Character:setSequence(“jensen_Character_back”)
jensen_Character:play()
else
jensen_Character:pause()
end
end
Runtime:addEventListener( “enterFrame”, enterMoveUp )
function upButton:touch (event)
if ( event.phase == “began” ) then
isMovingUp = true
jensen_Character.rotation = 0
elseif ( event.phase == “ended” ) then
isMovingUp = false
jensen_Character.rotation = 0
end
return true
end
upButton:addEventListener(“touch”, upButton)
--Move Down--
isMovingDown = false
function enterMoveDown ( event )
--print(“Moving Left”)
if isMovingDown == true then
jensen_Character.y = jensen_Character.y + 5
jensen_Character:setSequence(“jensen_Character_forward”)
jensen_Character:play()
else
jensen_Character:pause()
end
end
Runtime:addEventListener( “enterFrame”, enterMoveDown )
function downButton:touch (event)
if ( event.phase == “began” ) then
isMovingDown = true
jensen_Character.rotation = 0
elseif ( event.phase == “ended” ) then
isMovingDown = false
jensen_Character.rotation = 0
end
return true
end
downButton:addEventListener(“touch”, downButton)
jensen_Character:setSequence(“jensen_Character_forward”)
jensen_Character:play()
--Interactive Enviorment------------------------------------------
function interactive_Function()
if ( jensen_Character.x > 388 ) and ( jensen_Character.x < 745 ) and ( jensen_Character.y > 383) then
live_conditional_text.text = “This is a projector”
print(“Projector Text”)
end
end
timer.performWithDelay( 1000, interactive_Function, 0)
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
physics.stop()
end
– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view
package.loaded[physics] = nil
physics = nil
end
Why arent my sprites running? The first frame of it shows up but doesn’t scroll through the multiple frames? Thank you!