Scene not loading

Hello, I’m VERY new to Solar2D and having an issue loading a scene with the composer.

main.lua

local composer = require("composer")
local w, h = display.actualContentWidth, display.actualContentHeight

local splash = display.newImageRect("splash.png",w,h)
splash.alpha = 0.0
splash.x, splash.y = w/2, h/2

transition.to(splash, {
    time = 1000,
    alpha = 1.0,
    onComplete = function()
        transition.to(splash, {
            time = 1000,
            delay = 1000,
            alpha = 0.0,
            onComplete = function()
                splash:removeSelf()
                splash = nil

                composer.gotoScene("scene1")
            end
        })
    end
})

scene1.lua

local composer = require("composer")

local scene = composer.newScene()

return scene

When I run the project, I get the following error:

/Users/runner/work/corona/corona/platform/resources/init.lua:964: module 'scene1' not found:

File: /Users/runner/work/corona/corona/subrepos/composer/composer.lua
Line: 1457


stack traceback:
	[C]: in function 'error'
	/Users/runner/work/corona/corona/subrepos/composer/composer.lua:1457: in function 'gotoScene'
	main.lua:20: in function <main.lua:16>
	(tail call): ?
	/Users/runner/work/corona/corona/subrepos/transition/transition.lua:631: in function 'method'
	/Users/runner/work/corona/corona/platform/resources/init.lua:250: in function </Users/runner/work/corona/corona/platform/resources/init.lua:209>

I have checked the scene is named correctly and does not have any extra characters, and that both files are in the same folder. If it matters, I’m using macOS Sonoma 14.6. Any and all tips appreciated, thank you!!!

Hi!

What I would suggest in this case is setting up scene1 as described in the Composer library guide so we can see in which phase it fails. Here is the guide:

1 Like

Thanks for the reply! I figured out that the issue wasn’t actually with scene1 itself. My project folder was inside my Documents folder, and after moving it to my Desktop folder, it worked perfectly.

the best way always is to create a new project from Corona Simulator…

it will give you a good start to know how the project folder and code are structured

NewToSolar2D_Scenes.zip (499.6 KB)

1 Like