i tried to draw for example an ellipse inside functions. The background is set, but no drawing appears??
Here is a sample:
background(83, 46, 46, 255)
fill(205, 36, 36, 255)
what is my mistake??
I had similar, code that worked like yours before 1.5 doesn’t now.
You need to move it to draw (or a function called within draw)
eg (written without codea, probably got errors)
touch = nil
if t.state ~= ENDED then
touch = t
touch = nil
if touch ~= nil then
thank you for your quick reply, spacemonkey.
this makes things more complicated for me
.@StefanK your code will work fine in version 1.5.1. I’ve just tested it. This version is coming very soon (should be submitted to Apple within a day or so).
i have found that it’s hinky to do any drawing outside of draw() or some direct function that draw calls. Calling drawing in touched isn’t reliable from my expereince; i set variables there and let draw() read those and do the hard work.
Also, there is a variable called CurrentTouch, which is a hack for the immediate touch; you proably could remove lots of code and simply ellipse() off of CurrentTouch.
And you definitely want to move the background() call into draw().
@Simeon: i would appreciate that and wait for the new version (congratulations for the last update, i´m a newbie and like the references now very much
@aciolino: you´re right, it is straighter to do drawings under draw(), but sometimes it is more like my own thinking, to have functions, which independently do things.
@StefanK, that’s fine, almost al of my test code is like that; I create a function and call it. I’d sggest you make a function that is clearly defined, such as “function DrawEllipse()” and call that from draw(). It’s really a bad idea to override touch().
Even though they are going to patch it in 1.5.2, I’d not depend on it to always work both because 1)it got broke at least once, and 2) it’s bad form and hard to re-analyze.