Hi
I’ve encountered a really odd crash with the 2.5D game I’m working on. It’s turning into something of an epic, thousands of lines of code, and getting very sloppy round the corners. But it was pretty stable until today, when I started to adjust the way that the camera moves around.
This had the effect of making another part of the code, the explosions routine (or the score update routine, object cull routine etc etc), complete crash the Codea app (ie exit to the iPad home screen). i.e. This happened every time and was completely reproducible.
After going back over what I’d added, I eventually isolated one line that was causing the crash:
cam.offset.y = cam.offset.y - cam.velc.y
I eventually managed to fix this by making sure that the camera only moved by integers, using math floor and ceiling:
if cam.velc.y>0 then cam.dy=math.floor(cam.velc.y)
elseif cam.velc.y<0 then cam.dy=math.ceil(cam.velc.y) end
cam.offset.y = cam.offset.y - cam.dy
cam.velc = cam.velc - (cam.velc*0.2)
(At the moment, I’m just doing vertical scrolling, but it might end up scrolling in all directions, especially on a smaller iPhone screen)
Anyone have any idea why this is happening though?? The fix also is not ideal, as the deceleration of the scroll is not smooth anymore.
There must be some kind of interference or cross-talk with the explosion/cull/score routine, as the crash only occurs when that routine is called. It’s tricky though as the complete app crash means you don’t get a report from codea about what is going wrong
Is it worth syncing the iPad to iTunes and having a look at the codea crash log? Or are they tricky to decipher? Anyone had experience of a routine causing a persistent codea crash?