I am running 8 years old corona sdk project

I built a game 8 yeard back and did nothing after completing it. Now I really want build the apk again just to revive the memory. I was able to relaunch the project at least but scenes are not loading. I need suggestions to fix the errors as I have no touch with any changes.

main.lua is working but the next scene is not showing at all. Also there was no error in console too.

#main.lua

-- Include the Composer library
local composer = require( "composer" )

-- Removes status bar on iOS
-- https://docs.coronalabs.com/api/library/display/setStatusBar.html
display.setStatusBar( display.HiddenStatusBar ) 

-- -- Removes bottom bar on Android 
-- if system.getInfo( "androidApiLevel" ) and system.getInfo( "androidApiLevel" ) < 19 then
-- 	native.setProperty( "androidSystemUiVisibility", "lowProfile" )
-- else
-- 	native.setProperty( "androidSystemUiVisibility", "immersiveSticky" ) 
-- end

local bg_adjustment = 1

local bgimage = display.newImage("images/openingBG.jpg")
bgimage.xScale = (bg_adjustment  * bgimage.contentHeight)/bgimage.contentHeight
bgimage.yScale = bgimage.xScale
centerX = display.contentWidth / 2
centerY = display.contentHeight / 2
bgimage.x = centerX
bgimage.y = centerY

withScrn = display.contentWidth
heightScrn = display.contentHeight
topScrn = display.screenOriginY
leftScrn = display.screenOriginX


composer.gotoScene( "mainMenu", { effect = "fade"} )

#mainMenu.lua

local storyboard = require( "composer" )
local scene = storyboard.newScene()
local widget = require("widget")



local function btnTap(event)
	storyboard.gotoScene (  event.target.destination, {effect = "slideLeft"} )
	return true
end

local function btnTap1(event)
	os.exit()
	return true
end

function scene:createScene( event )

	local group = self.view
	
	local title = display.newImageRect( "images/gameTitle.png", 250 , 160 )
	title.x = centerX
	title.y  = 80
	group:insert(title)

	clouds ={
	 {getImage = "images/cloud01.png"}, 
	 {getImage = "images/cloud02.png"},
	 {getImage = "images/cloud03.png"}
	}

	for i=0,2 do

	imagesId = math.random (1,3)
	local cloud = display.newImage(clouds[imagesId].getImage   )
	cloud.x = math.random (display.screenOriginX , centerX )
	cloud.y = math.random (display.screenOriginY + cloud.height, centerY)
	group:insert(cloud)
	cloud.alpha = 0.7
	transition.to( cloud, {time = math.random (30000 , 120000), x = withScrn + 300 } )

	end 



	local optionsBtn = widget.newButton
	{
	width = display.contentWidth*0.8,
    height = (display.contentWidth*0.8)/4,
    defaultFile = "images/button_notpressed.png",
    overFile = "images/button_pressed.png",
    label="Snake-Ladder",
	labelColor = { default = { 250, 255, 250}, 
						over ={0,0,0  }},
	fontSize = "35",
	}
	optionsBtn.x = centerX
	optionsBtn.y = title.y + 180
	optionsBtn.destination = "snakeMenu"
	optionsBtn:addEventListener("tap", btnTap)
	group:insert(optionsBtn)

	sheetData = { width=200, height=200, numFrames=8, sheetContentWidth=800, sheetContentHeight=400 }
	 
	mySheet = graphics.newImageSheet( "images/snakesprite.png", sheetData )

	sequenceData = {
	 
	  { 
	  	name = "normalRun",  
	    start = 1,  
	    count = 8,  
	    time = 1600,  
	    loopCount = 0, 
	    loopDirection = "bounce"  
	  } 
	 
	}

	local animation = display.newSprite( mySheet, sequenceData )
	animation.x = display.contentWidth / 2
	animation.y = optionsBtn.y + 130
    animation:play()
    group:insert(animation)

    reloadbtn = display.newImageRect ("images/quit.png", 112, 117)
	reloadbtn.x = display.contentWidth-40
	reloadbtn.y = display.contentHeight- 40
	reloadbtn.width = 50
	reloadbtn.height =50
	reloadbtn.destination = "ludoai" 
	reloadbtn:addEventListener("touch", btnTap1)
	group:insert(reloadbtn)
end

local function onKeyEvent( event )
		    if (event.keyName == "back") and (system.getInfo("platformName") == "Android") then 
				return true
		    end

		    
		end

function scene:enterScene( event )
	local group = self.view
	Runtime:addEventListener( "key", onKeyEvent );
	

end



function scene:exitScene( event )
	local group = self.view

	

end



function scene:destroyScene( event )
	local group = self.view


end




scene:addEventListener( "createScene", scene )
scene:addEventListener( "enterScene", scene )
scene:addEventListener( "exitScene", scene )
scene:addEventListener( "destroyScene", scene )


---------------------------------------------------------------------------------

return scene---------------------------------------------------------

1 Like

Welcome back!

You’re missing scene:show() from composer.

It seems you were migrating from storyboard to composer at one point. You can use the composer template found here, copy your code into the correct places and it should load up properly.

Thank you so much for your reply. Let me try that and let you know

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.