I understand that Codea uses a state-machine paradigm. That solves as many programming issues as it creates, however. I am also looking at Python as a solution… But it’s… Python.
Is it possible that Codea will ever be able to support a functional paradigm? Or, are the underpinnings so wrapped up in the current design as to make this impossible? Or, hopefully, I am just missing something and I can hide the whole draw() function?
@Ignatz Directly, parameter callbacks, draw, touched, collision, and orientationChanged are the only event triggers.
Setup is ran after every tab is loaded, but you don’t have to have the initialization code in it. If there is only the tab Main, then the initialization code can go at the bottom. If there are multiple tabs, it goes at the bottom of the last tab. With tabs (or without) it’s better to be in setup, but it doesn’t have to be.
Indirectly, you can also use tween.delay to set up a custom loop. I did this instead of draw for a more compact timer in my 50 line competition entry.
If you don’t use draw, you can still draw on the screen. You can draw it in setup (or floating) and remove the draw function completely and what you drew will stay there. You can also draw it in any event trigger, including touched, tween.delay, etc.