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?
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
end
end
scenemanager().loadScene(“myScene”)
function draw()
for i =1, #scene do
scene[i]:draw()
end
end
myScenes = {
myScene = {
sprite(assets. thing),
sprite(assets. thing2),
sprite(assets. thing3),
MyCustomGameObject()
}
}
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