ok here is the fix: note the essential physics.removeBody call in collisionHandler function
\_G.w = display.contentWidth \_G.h = display.contentHeight \_G.W = display.contentWidth \_G.H = display.contentHeight \_G.centerX = w/2 \_G.centerY = h/2 \_G.displayWidth = (display.contentWidth - display.screenOriginX\*2) \_G.displayHeight = (display.contentHeight - display.screenOriginY\*2) \_G.unusedWidth = \_G.displayWidth - \_G.w \_G.unusedHeight = \_G.displayHeight - \_G.h local vehicleCollisionFilter = nil--{ categoryBits = 1, maskBits = 16 }; local playerCollisionFilter = nil--{ categoryBits = 2, maskBits = 14 }; local DPad = require("dpad") --load map local mte = require("mte") mte.enableBox2DPhysics() mte.physics.start() mte.physics.setGravity(0, 0) mte.physics.setDrawMode("hybrid") mte.loadTileSet("newyork\_bg\_tiles", "newyork\_bg\_tiles.png") mte.loadTileSet("newyork\_objects", "newyork\_objects.png") mte.loadMap("new\_york") -- load dpad local dpad = DPad.create(0, \_G.displayHeight-30) dpad.isVisible = true --go to correct position on map local map = mte.getMap(); local marg = 400; local CELL\_WIDTH = 64; mte.goto({locX = 1, locY = 1, blockScaleX = 64, blockScaleY = 64, cullingMargin={top=marg,left=marg, right=marg, bottom=marg }}); local diffHeight = ((map.height)\*CELL\_WIDTH) - \_G.displayHeight ; mte.moveCameraTo({levelPosX = (map.width\*CELL\_WIDTH)/2, levelPosY = (((map.height)\*CELL\_WIDTH)/2 )+(diffHeight/2), time=1, easing="linear"}); -- add circle/player to mte local circle = display.newCircle(10,10,10); local setup ={ name = "circle", kind = "sprite", layer = 1, locX = 12, locY =13, levelWidth = circle.width , levelHeight = circle.height } mte.addSprite(circle,setup) -- set up physics for circle/player local halfwidth = 8; local halfheight =8; local playerShape = { halfwidth, halfheight , -halfwidth, halfheight , -halfwidth, -halfheight , halfwidth, -halfheight } function addPlayerPhysics() mte.physics.addBody( circle,"dynamic", {friction = 0.2, bounce = 0.0, density = 1, shape = playerShape, filter = playerCollisionFilter, isSensor=true, isBullet=true }) circle.isFixedRotation = true circle.isSensor = true; circle.isBodyActive = true circle.objectType = "player" end addPlayerPhysics(); function collisionHandler( event ) if event.phase == "began" then local type1 = event.target.objectType local type2 = event.other.objectType print("collisionHandler " .. type2); if(type2=="vehicle") then timer.performWithDelay( 50, function() mte.physics.removeBody(circle); local gotopos = mte.convert("locToLevelPos", 12, 13, 1) mte.moveSpriteTo({levelPosX=gotopos.x, levelPosY=gotopos.y,sprite=circle,time=1 }) timer.performWithDelay( 50, function() addPlayerPhysics() end); end); elseif (type2=="pickup") then end end end circle:addEventListener ( "collision", collisionHandler ) function createCollidableVehicle(locx,locy,name) local circleVeh = display.newCircle(10,10,15); local halfwidth = 16; local halfheight =16; local playerShape = { halfwidth, halfheight , -halfwidth, halfheight , -halfwidth, -halfheight , halfwidth, -halfheight } --circleVeh:setFillColor(255,0,0) local setup ={ name = name, kind = "sprite", layer = 1, locX = locx, locY =locy, levelWidth = circleVeh.width , levelHeight = circleVeh.height } mte.addSprite(circleVeh,setup) mte.physics.addBody( circleVeh,"dynamic", {friction = 0.2, bounce = 0.0, density = 1, shape = playerShape, filter = vehicleCollisionFilter, isSensor=true, isBullet=true }) circleVeh.isFixedRotation = true circleVeh.isSensor = true; circleVeh.isBodyActive = true circleVeh.objectType = "vehicle" end -- create static collidable vehicles createCollidableVehicle(9,9,"vehicle1"); createCollidableVehicle(8,9,"vehicle2"); createCollidableVehicle(6,9,"vehicle3"); createCollidableVehicle(5,9,"vehicle4"); --START--------------UTILITY FUNCTIONS------------------------- function pointAngle(xA, yA, xB, yB) local angle = math.atan2(yB - yA, xB - xA) if (angle \< 0) then angle = math.abs(angle) else angle = 2 \* math.pi - angle end return math.deg(angle) end -- Distance between two given points function pointDistance(xA, yA, xB, yB) local xDistance = xB - xA local yDistance = yB - yA return math.sqrt((xDistance \* xDistance) + (yDistance \* yDistance)) end -- Is a point inside a circle? function pointInCircle(xA, yA, xCircle, yCircle, radiusCircle) return (pointDistance(xCircle, yCircle, xA, yA) \<= radiusCircle) end --END--------------UTILITY FUNCTIONS------------------------- local offset = 20; --move object function move (player, angle) local newX = player.locX; local newY =player.locY; local jumpDistance = 1; if((angle \>= 315 and angle \<= 359) or (angle \>=0 and angle \<= 45)) then newX = player.locX + jumpDistance; elseif (angle \<= 315 and angle \>= 225) then newY = player.locY + jumpDistance; elseif (angle \<= 225 and angle \>= 135) then newX = player.locX - jumpDistance; elseif (angle \>= 45 and angle \<= 135) then newY = player.locY - jumpDistance; end print("moveSpriteTo locX " ..newX .." locY " ..newY ) local gotopos = mte.convert("locToLevelPos", newX, newY, 1) mte.moveSpriteTo({levelPosX=gotopos.x-offset, levelPosY=gotopos.y-offset,sprite=player,time=1}) end ---handle touches on dpad and move player local function touchManager(event) if (event.phase == "began") then end if (event.phase == "cancelled" or event.phase == "ended") then print("click") if( pointInCircle(event.x, event.y, dpad.x, dpad.y, 50) )then local angle = DPad.getAngle(dpad, event) print(angle); if(angle) then move(circle, angle) else print("respawn"); local gotopos = mte.convert("locToLevelPos", 12, 13, 1) mte.moveSpriteTo({levelPosX=gotopos.x-offset, levelPosY=gotopos.y-offset,sprite=circle,time=1 }) end end end return true end Runtime:addEventListener("touch", touchManager) --do game loop local g\_timelast = 0; --[[the main game Loop]]-- local function dogameloop() local tm = system.getTimer(); local millisecondspassed = tm-g\_timelast; local dt = (millisecondspassed) / (1000/30); g\_timelast =tm; mte.update(); end Runtime:addEventListener ( "enterFrame", dogameloop );