Splash Screens

Hello, I am newbie programmer trying to make my first mobile game.
I am having trouble finding a tutorial on how to make a splash screen. Any help is greatly appreciated.

(I mostly just need to know to make that automatic transition effect from one scene to another. I pretty much just want it to last about 5 secs then have it automatically change to the main menu.)

Thanks in advanced.

I suspect that what you really need here is a state manager. If you type “finite state machine” into the search box, you’ll see lots of approaches to this issue. This will allow you to manage transitions between not just the splash and menu screens, but also the game itself, gameover screens etc.

The idea is to try to avoid having a super-long draw function with long-branching if statements for each state the game can be in, as these will eventually become a nightmare to read.

This is my favourite solution to this:

https://codea.io/talk/discussion/comment/63797/#Comment_63797

Thank you, thank you, thank you so much!

@maladroitr2 While you’re searching for state machine, here’s a simple example of showing a splash screen for 5 seconds and then it switches to a menu screen. Of course you’ll have to change everything here to suit your own needs.

displayMode(FULLSCREEN)

function setup()
    menuScreen=image(300,400)
    setContext(menuScreen)
    fill(255)
    fontSize(75)
    text("Menu",150,350)
    fontSize(30)
    text("Play Game",150,200)
    text("Instructions",150,150)
    fontSize(20)
    text("Make a selection.",150,50)
    setContext()
    s=555
    a=255   
end

function draw()
    background(40, 40, 50)
    tint(255,255,255,a)
    sprite("Cargo Bot:Startup Screen",WIDTH/2,HEIGHT/2)
    tint(255,255,255,255-a)
    sprite("Cargo Bot:Starry Background",WIDTH/2,HEIGHT/2,700)
    sprite(menuScreen,WIDTH/2,HEIGHT/2,500)
    if s>0 then
        s=s-1
        if s<255 and a>0 then
            a=a-1
        end
    end
end

Wow, thank you so much! That’s very helpful.