Hello everyone,
I recently posted about the error that I kept receiving and now i think i know the reason behind it but still i don’t know how to fix it.
So this is what i think the error is caused by:
The only time that i receive the error is when i drag the my mouse from the screen over the object that i want to move. So when the object is touched it is in the event.phase==moved section as the touch began before the object being touched. Therefore the code in the begin section where startMoveX is defined is not processed and so in the moved section it is nil.
In the codes below ive also indicated the line of the error.
I don’t know how to fix this error but i think that’s the reason.
local function movePlatform(event) platformTouched = event.target if (event.phase == "began") then display.getCurrentStage():setFocus( platformTouched ) audio.play (selectionSound) display.remove( rotationalert ) rotationalert = nil platformTouched.startMoveX = platformTouched.x platformTouched.startMoveY = platformTouched.y elseif (event.phase == "moved") then -- The line below is the 392th line, where the error arises: platformTouched.x = (event.x - event.xStart) + platformTouched.startMoveX platformTouched.y = (event.y - event.yStart) + platformTouched.startMoveY elseif event.phase == "ended" or event.phase == "cancelled" then display.getCurrentStage():setFocus( nil ) end return true end
I have also attached a picture of the error as well as a video of when I get the error.
Every help would be greatly appreciated.