I know this is strictly not Codea - I use LoveCodea to develop on the PC. Most of you know that it is a wrapper for Love2D which enables you to run Codea code in a window on a PC (or Mac). I have used it for some time now with only a few niggles. But I ran into a problem when looking at basic terrain code, see the ignatz thread on Noise …
I had a problem getting the basic code to run on my iPad (blue screen only - no terrain) so I started to play around with it on LoveCodea. Managed to get the code running but after a short time Love2D shutdown with an error. What the code does is build up a terrain by drawing lines which are stored in an image() using setContext() and then used as a sprite to reduce maintain a good FPS. I think there is an error in LoveCodea which leads to memory leaks so I’m not expecting any help there. Could someone please check the code from @ignatz on their iPad to see if they have a similar problem. I use an iPad 2.
This example falls down on LoveCodea:
-- demo of shaped image if require ~= nil then require("loveCodea") end function setup() img = image(1023,767) setContext(img) -- background(255, 255, 255, 255) strokeWidth(1) stroke(255,0,0,255) for x=0,1023 do y = math.random(1)*767 line(x,0,x,y) end setContext() end -- This function gets called once every frame function draw() -- This sets a dark background color background(255, 255, 255) -- This sets the line thickness strokeWidth(5) -- Do your drawing here sprite(img, WIDTH/2, HEIGHT/2) end