Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --FUNCTION FOR PLAYERMOVEMENT
- --FUNCTION FOR PLAYERMOVEMENT
- local playerMovement = function()
- if nil ~= player then
- if player.state == STATE_WALKING then
- print("walking") --DEBUGIUNG
- player:applyForce(player.direction * 20, 0, player.x, player.y)
- else
- print("Idle") --DEBUGIUNG
- local vx, vy = player:getLinearVelocity()
- if vx ~= 0 then
- player:setLinearVelocity(vx * 0.9, vy)
- end
- end
- else
- player:removeSelf()
- player=nil
- end
- end
- --[[
- --------------------------
- Result in Terminal window:
- ---------------------------
- Runtime error
- /Users/Hendrix/Desktop/MM/GameLogic.lua:192: attempt to compare nil with number
- stack traceback:
- [C]: ?
- /Users/Hendrix/Desktop/MM/GameLogic.lua:192: in function </Users/Hendrix/Desktop/MM/GameLogic.lua:185>
- ?: in function <?:215>
- --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement