I'm trying to move my object around via the touch method, which works fine expect if they are being affected by physics, in which case the second I stop moving my mouse in the simulator, the object starts to fall (Being affected by gravity) instead of staying in one position.
Here's the code I'm using.
1 2 3 4 5 6 7 8 9 10 11 12 | function moveBuildingBlock(e) if (e.phase=="began") then display.getCurrentStage():setFocus(e.target, e.id); e.target:setReferencePoint(display.CenterReferencePoint); elseif (e.phase=="moved") then e.target.x = e.x; e.target.y = e.y; elseif (e.phase=="ended") then display.getCurrentStage():setFocus(e.target, nil); end end block:addEventListener("touch", moveBuildingBlock) |
this forum category is related to the Lua language itself. your question belongs in the "developer support" or "game edition" forum really