Finalizing the game loop

Need some help learning how to create a start and stop for my first game.
I’m not sure how to set the “swipe to start”
Death conditions for now are just leaving the screen but I’d like to implement the don’t eat your tail part as well.
And maybe a review if possible?

Here’s the code so far

Since my phone doesn’t like the ~~~ I’ll do this.
Thank you Ron Jeffres tutorials

@Dezmo Your code can’t be copied correctly. If it does copy, it includes the line numbers and when it’s pasted into a Codea project, it’s messed up.

Just post it from your phone and don’t worry about the formatting with the ~~~ .

@Dezmo - took a bit of transferring, and a little tidying. Exported for general viewing. Not sure what you mean by swipe to start.

I’m not sure if I’m using this word correctly but like a splash page before the game itself begins

@Bri_G also thank you from now on I’ll just post the text itself

@dave1707 oh god no

@Dezmo - try this.

what you want is a “Scene Manager” that basically loads into memory your game objects/entities and then you can have a call like “loadScene(name)” with take the name of your scene and has a reference to the list of entities to load

you would also need a destroy() to remove objects from memory if those objects store any persistent data

scene = {}

scenemanager = class()
function scenemanager:init()end
function scenemanager:loadScene(name)
  oldScene = scene
  scene = myScenes[name]
  for i=1,#oldScene do
    oldScene[i]:destroy() — you will need to add this if needed


function draw()
  for i =1, #scene do

myScenes = {
  myScene = {
    sprite(assets. thing),
    sprite(assets. thing2),
    sprite(assets. thing3),

i have a complex project that tries to simplify how the draw loop works in Codea, i will eventually share it

the point here is that one of your scenes can be a black screen, loading screen, splash image