HI guys plz excuse my ignorance on this one I have totally confused myself over the past few days trying to sort his out.
Firstly is Scene and Screen the same thing?
I have begun a first draft game and have a main.lua and a game.lua
On the main.lua I have a few images and a button (iOS). In the corona simulator I select run and it runs my main screen . Im having trouble understanding what I need for code on that button so it opens the game screen. At this stage the game screen has a background only but when I press the [play game] button on the main screen nothing happens. I tell a lie the print command works that the button was pressed/released but thats all. I can’t work out how to goto the game screen after pressing the button.
Hope someone can get me past this lack of understanding moment.
david (big-db)
main.lua
[lua] widget = require(“widget”)
widget.setTheme( “widget_theme_ios” )
require(“game”)
local composer = require( “composer” )
local scene = composer.newScene(“game”)
–Function to handle button events
local function handleButtonEvent( event )
composer.gotoScene(“game”)
if ( “ended” == event.phase ) then
print( “Button was pressed and released” )
end
end
– Create the button object
local testButton = widget.newButton
{
left = 70,
top = 300,
label = “Play Game”,
onEvent = handleButtonEvent
}
[/lua]
game.lua
[lua] iImage = display.newImage(“slateBG.png”) [/lua]