How to add a splash screen

I’ll add this to the wiki in a bit. Please let me know how this works, if you try it. This is using Dagon version


All images for the introduction should be prefaced by “intro_”, so name your splash screen image “intro_Splash.png” and put it in the Resources/images folder.
Next you’ll need to alter the intro.lua module in the Modules folder. Open it in a text editor. I use Notepad++.

The Splash screen should play right after the Dagon intro screen and just before the Title screen. In the intro module, the Title screen is referred to as the Logo.

  1. In the Intro.create function, after the line -

    Add -

  2. To specify the image to be used for your splash screen and to set the visibility of the image, directly after the line -

    Add -

  3. You’ll need to disable the logo’s visibility, so that your splash screen shows up first. To do this, add the line self.imgLogo:disable() after the logo’s image info so that it looks like this -

    self.imgLogo = Image("intro_logo.png") self.imgLogo:scale(0.5) self.imgLogo:disable()

  4. A little further down in the file, after all of the images for the intro have been established, add your splash screen between the intro overlay and the logo like this -

    self.ovrIntro = Overlay("Intro") self.ovrIntro:addImage(self.imgSplash) -- your splash screen self.ovrIntro:addImage(self.imgLogo)

  5. In the Intro:start function, add your splash screen after the intro overlay is enabled -

    self.ovrIntro:enable() self.imgSplash:enable() -- play your splash screen play("my_splash_screen_sound.ogg") -- play a sound with the splash screen

  6. Directly after that, you need to add your splash screen into the timer in front of the logo screen, like this -

    self.timerID = startTimer(4, true, function() if (self.timerLoop == 1) then self.imgSplash:fadeOut() node:fadeIn() musicLayer1:play() elseif (self.timerLoop == 2) then self.imgLogo:fadeIn() cursor.fadeIn() journal:enable() elseif (self.timerLoop == 4) then self.imgLogo:fadeOut() self.imgCredit1:fadeIn() – and so on until all of your intro credit screens are entered into the timer.

  7. In the Intro:resize function, add your splash screen and center it -

    [code]function Intro:resize()
    local w, h = 0

    w, h = self.imgSplash:size()
    self.imgSplash:setPosition((config.displayWidth / 2) - (w / 2),
    (config.displayHeight / 2) - (h / 2))[/code]

That’s it. Save your Intro module and run your Dagon.exe file. You should see your splash screen play directly after the Dagon intro screen and it should fade away as your games title appears.

Nice one Imari :smiley:


Amazing…Great work Imari!

Thanks :smiley: