After i change the scene from level1 to level2(i am using scenemanager), I get an error, here is the code:
local function move(event)
if gameisActive == true then
shipangle = math.floor(180-math.atan2(ship.x - fire.x, ship.y - fire.y)\*(180/math.pi)) --line 232--
if touch == true then
local touchangle = math.floor(180-math.atan2(eventx - ship.x, eventy - ship.y)\*(180/math.pi))
local differ = touchangle - shipangle
if differ \< -180 then
tdiffer = 360 + differ
elseif differ \> 180 then
tdiffer = differ - 360
else
tdiffer = differ
end
if shipangle ~= touchangle then
ship.rotation = ship.rotation + tdiffer/2
end
end
end
end
here is the error i keep getting, and remember, it works if i start off on this level, but when i go from level1 to level2, it will show this error:
Runtime error
.../coryl/Desktop/CoronaSDKApps/spaceMission/level2.lua:232: attempt to perform arithmetic on field 'x' (a nil value)
stack traceback:
[C]: ?
.../coryl/Desktop/CoronaSDKApps/spaceMission/level2.lua:232: in function <...><br> ?: in function <?:215><br>
thanks for any help [import]uid: 41565 topic_id: 24926 reply_id: 324926[/import] </…>