Tutorial 11: Player Spawn Problem

Hi,

I’m new in Lime+Corona+Lua+Mobile (it’s a lot of things!  :P). BTW I’m trying to follow the Lime tutorials on OutLaws site and I’m stuck on the tutorial 11.

It seems that the map:addPropertyListener( “IsPlayer”, onPlayerProperty ) it’ll never triggered, that will cause that the player variable will never filled and that will cause a nil player error.

My player tile has the correct properties and I’ve followed the tutorial step-to-step but I can’t go on.

can anyone help me?
thanks very much

best regards

PS: this is my code

-- lime variable should be global not local lime = require( "lime.lime" ) ui = require( "lime.ui" ) local physics = require( "physics" ) physics.start() -- constants local STATE\_IDLE = "Idle" local STATE\_WALKING = "Walking" local STATE\_JUMPING = "Jumping" local DIRECTION\_LEFT = -1 local DIRECTION\_RIGHT = 1 --[[Objects Functions]]-- local onPlayerProperty = function(property, type, object) player = object.sprite playerAdded = true; print("player added") -- collision detection player.collision = onCollision player:addEventListener( "collision", player ) end local function onCollision( self, event ) if( event.phase == "began" ) then if event.other.IsGround then player.canJump = true end elseif( event.phase == "ended" ) then if event.other.IsGround then player.canJump = false end end end local onUpdate = function(event) if player.state == STATE\_WALKING then player:applyForce(player.direction \* 10, 0, player.x, player.y) elseif player.state == STATE\_IDLE then local vx, vy = player:getLinearVelocity() if vx ~= 0 then player:setLinearVelocity(vx \* 0.9, vy) end end end local onButtonLeftEvent = function(event) if event.phase == "press" then player.direction = DIRECTION\_LEFT player.state = STATE\_WALKING else player.state = STATE\_IDLE end end local onButtonRightEvent = function(event) if event.phase == "press" then player.direction = DIRECTION\_RIGHT player.state = STATE\_WALKING else player.state = STATE\_IDLE end end local onButtonAPress = function(event) if player.canJump then player:applyLinearImpulse(0, -5, player.x, player.y) player.state = STATE\_JUMPING end end local onButtonBPress = function(event) end --[[/Objects Functions]]-- -- load up the map map = lime.loadMap( "map09.tmx" ) -- display a background image local background = display.newImageRect( "background.jpg", display.contentWidth, display.contentHeight ) background:setReferencePoint( display.TopLeftReferencePoint ) background.x, background.y = 0, 0 -- display the map local visual = lime.createVisual( map ) local physical = lime.buildPhysical( map ) --[[Objects Listeners]]-- map:addPropertyListener( "IsPlayer", onPlayerProperty ) --[[/Objects Listeners]]-- --[[Placing Controls]]-- local buttonLeft = ui.newButton{ default = "buttonLeft.png", over = "buttonLeft\_over.png", onEvent = onButtonLeftEvent } buttonLeft.x = buttonLeft.width / 2 + 10 buttonLeft.y = display.contentHeight - buttonLeft.height / 2 - 10 local buttonRight = ui.newButton{ default = "buttonRight.png", over = "buttonRight\_over.png", onEvent = onButtonRightEvent } buttonRight.x = buttonLeft.x + buttonRight.width buttonRight.y = buttonLeft.y local buttonA = ui.newButton{ default = "buttonA.png", over = "buttonA\_over.png", onEvent = onButtonAPress } buttonA.x = display.contentWidth - buttonA.width / 2 - 10 buttonA.y = display.contentHeight - buttonA.height / 2 - 10 local buttonB = ui.newButton{ default = "buttonB.png", over = "buttonB\_over.png", onEvent = onButtonBPress } buttonB.x = buttonA.x - buttonB.width buttonB.y = buttonA.y --[[/Placing Controls]]-- Runtime:addEventListener( "enterFrame", onUpdate )

Never mind, it was my fault and I’ve fixed it…
I’ve still problem on tutorial 8 (Complex Physics Objects), but I’ll try to fix it…

Never mind, it was my fault and I’ve fixed it…
I’ve still problem on tutorial 8 (Complex Physics Objects), but I’ll try to fix it…