I have been building my first full game with corona over the past 2 months with no major issues (really love it!) but I’ve suddenly encountered this strange bug and I can’t tell how long it has been here.
I have, up until this week, done all development on my Windows 10 desktop and from here I can build signed and debug versions of the app to android perfectly fine.
When I moved the project to my macbook and windows 10 laptop I found that the simulator runs exactly as expected but when testing on either my iphone or Nexus 6p I see that the code from my main.lua all runs and then I get a blank screen.
Here is a cut-down version of my main.lua:
local composer = require( "composer" ) -- Hide status bar display.setStatusBar( display.HiddenStatusBar ) display.setDefault( "background", 0.17, 0.24, 0.29 ) local splashBackground = display.newRect( display.contentCenterX, display.contentCenterY, 2\*display.contentWidth, 2\*display.contentHeight ) splashBackground:setFillColor(1) local splashLogo = display.newImageRect( "prlogo.png", display.contentCenterX\*2/3, display.contentCenterX\*2/3) splashLogo.x = display.contentCenterX splashLogo.y = display.contentCenterY ------------------------------------------------------------ TODO: Remove warning for public release builds------------------------------------------------------------------ native.showAlert( "Thank you for playing!", "Please remember this is a development build. You may find bugs which can be reported at ############################", {"I understand"}) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- composer.gotoScene( "menu" )
I can tell that my main.lua file runs as i have permanent debugText element there (with alpha usualy set to) which displays what I want there. The problem is that the elements that i create in scene:create() do not display (but i know it runs because i can change my debugText in that method).
Here is a cut-down version of the code in menu.lua
local composer = require( "composer" ) local scene = composer.newScene() -- ----------------------------------------------------------------------------------- -- Code outside of the scene event functions below will only be executed ONCE unless -- the scene is removed entirely (not recycled) via "composer.removeScene()" -------------------------------------------------------------------------------------- local playButton local shopButton local shareButton local rateButton local highScoresButton local storeButton local pulseIconIn, pulseIconOut local trans local debugText --hide debug message local function hideDebug() transition.to( debugText, { time=200, delay=1000, alpha=0, y=0}) end --display debug message local function showDebug( string ) debugText.text = string transition.to( debugText, { time=200, alpha=1, y=display.contentHeight/20, onComplete=hideDebug}) end --debug Text with 0 alpha be default debugText = display.newText( "Coming soon!", display.contentCenterX, 0, "Bauhaus-93\_6274.ttf", (display.contentHeight-display.contentWidth)/8) debugText.alpha = 0 debugText:setFillColor(0) --------------------------------------------------------------------------------------------------------------------- -----Functions to control button clicks are here----- --------------------------------------------------------------------------------------------------------------------- ------HANDLE SYSTEM EVENTS------ local function onAccelerate( event ) shopButton.rotation = -event.xGravity\*100 shareButton.rotation = -event.xGravity\*100 rateButton.rotation = -event.xGravity\*100 highScoresButton.rotation = -event.xGravity\*100 storeButton.rotation = -event.xGravity\*100 end -- ----------------------------------------------------------------------------------- -- Scene event functions -- ----------------------------------------------------------------------------------- -- create() function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen local logo = display.newImageRect( sceneGroup, "logo.png", display.contentWidth, display.contentWidth ) logo.x = display.contentCenterX logo.y = display.contentCenterY / 3 playButton = display.newImageRect( sceneGroup, "play.png", display.contentCenterX/2, display.contentCenterX/2) playButton.x = display.contentCenterX playButton.y = display.contentCenterY playButton:addEventListener( "tap", gotoGame ) shopButton = display.newImageRect( sceneGroup, "shop-icon.png", display.contentWidth/8, display.contentWidth/8 ) shopButton.x = display.contentCenterX shopButton.y = display.contentHeight\*7/8 shopButton:addEventListener( "tap", gotoDevPage ) shareButton = display.newImageRect( sceneGroup, "share-icon.png", display.contentWidth/8, display.contentWidth/8 ) shareButton.x = display.contentCenterX - display.contentWidth/4 shareButton.y = display.contentHeight\*7/8 shareButton:addEventListener( "tap", shareApp ) rateButton = display.newImageRect( sceneGroup, "star-icon.png", display.contentWidth/8, display.contentWidth/8 ) rateButton.x = display.contentCenterX + display.contentWidth/4 rateButton.y = display.contentHeight\*7/8 rateButton:addEventListener( "tap", rateApp ) highScoresButton = display.newImageRect( sceneGroup, "score-icon.png", display.contentWidth/8, display.contentWidth/8 ) highScoresButton.x = display.contentCenterX - display.contentWidth/8 highScoresButton.y = display.contentHeight\*6/8 highScoresButton:addEventListener( "tap", displayHighScores ) storeButton = display.newImageRect( sceneGroup, "store-icon.png", display.contentWidth/8, display.contentWidth/8 ) storeButton.x = display.contentCenterX + display.contentWidth/8 storeButton.y = display.contentHeight\*6/8 storeButton:addEventListener( "tap", gotoShop ) Runtime:addEventListener( "accelerometer", onAccelerate ) end -- show() function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is still off screen (but is about to come on screen) elseif ( phase == "did" ) then -- Code here runs when the scene is entirely on scree pulseIconIn( playButton ) end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) elseif ( phase == "did" ) then -- Code here runs immediately after the scene goes entirely off screen transition.cancel(trans) end end -- destroy() function scene:destroy( event ) local sceneGroup = self.view -- Code here runs prior to the removal of scene's view end -- ----------------------------------------------------------------------------------- -- Scene event function listeners -- ----------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ----------------------------------------------------------------------------------- return scene
- I have ensured that the projects are identical by syncing the same repository on our bitbucket server.
- I have tried building with the same corona build (2016.2830)
- I have tried installing the same versions of JDK on both my desktop and laptop (7u79 AND 7u80)
Can anyone lend some ideas?