Okay no problem
Screen 1
[lua]module(…, package.seeall)
function new()
local localGroup = display.newGroup()
–> This is how we start every single file or “screen” in our folder, except for main.lua
– and director.lua
–> director.lua is NEVER modified, while only one line in main.lua changes, described in that file
local ui = require(“ui”)
local screen3 = display.newImage (“screen3.png”)
localGroup:insert(screen3)
–> This sets Screen2
local optimistic = display.newImage (“optimistic.png”)
optimistic.x = 100
optimistic.y = 385
optimistic.xScale = .5
optimistic.yScale = .5
localGroup:insert(optimistic)
local function touchedOptimistic (event)
if (“ended” == event.phase) then
director:changeScene (“screen4a”)
media.playEventSound( “click_x.caf” )
end
end
optimistic:addEventListener (“touch”, touchedOptimistic)
–>This places the optimistic button
local skeptical = display.newImage (“skeptical.png”)
skeptical.x = 230
skeptical.y = 385
skeptical.xScale = .5
skeptical.yScale = .5
localGroup:insert(skeptical)
local function touchedSkeptical (event)
if (“ended” == event.phase) then
director:changeScene (“screen4”)
media.playEventSound( “click_x.caf” )
end
end
skeptical:addEventListener (“touch”, touchedSkeptical)
–>This places the skeptical button
–>MUST return a display.newGroup()
–> This is how we end every file except for director and main, as mentioned in my first comment
return localGroup
end[/lua]
This is the screen I’m trying to make the split on next
[lua]module(…, package.seeall)
function new()
local localGroup = display.newGroup()
–> This is how we start every single file or “screen” in our folder, except for main.lua
– and director.lua
–> director.lua is NEVER modified, while only one line in main.lua changes, described in that file
local ui = require(“ui”)
– Predefine local objects for use later
local numberFieldSeven, numberFieldEight
local fields = display.newGroup()
local inputFontSize = 30
local inputFontHeight = 30
local tHeight = 50
local screen5 = display.newImage (“screen5.png”)
localGroup:insert(screen5)
–> This sets Screen5
local smallbrain = display.newImage (“smallbrain.png”)
smallbrain.x = 270
smallbrain.y = 430
smallbrain.xScale = .5
smallbrain.yScale = .5
localGroup:insert(smallbrain)
–>This places the brain
local function touchedSmallbrain (event)
if (“ended” == event.phase) then
_G.numberEight = numberFieldEight.text
director:changeScene (“screen6”)
media.playEventSound( “click_x.caf” )
end
end
smallbrain:addEventListener (“touch”, touchedSmallbrain)
– Tapping screen dismisses the keyboard
local listener = function( event )
– Hide keyboard
print(“tap pressed”)
native.setKeyboardFocus( nil )
end
Runtime:addEventListener( “tap”, listener )
– This cleanUp function will remove all listeners from the scene since
– Director can’t remove listeners itself
local cleanUp = function()
Runtime:removeEventListener(“tap”, listener)
smallbrain:removeEventListener(“touch”, touchedSmallbrain)
end
– Determine if running on Corona Simulator – Native Text Fields not supported on Simulator
local isSimulator = “simulator” == system.getInfo(“environment”)
if isSimulator then
msg = display.newText( “Native Text Fields not supported on Simulator!”, 0, 280, nil, 12 )
msg.x = display.contentWidth/2 – center title
msg:setTextColor( 255,255,0 )
end
numberFieldSeven = native.newTextField( 50, 80, 85, tHeight, onnumberFieldSeven )
numberFieldSeven.font = native.newFont( native.systemFontBold, inputFontSize )
numberFieldSeven.inputType = “number”
numberFieldSeven.align = “center”
numberFieldSeven.text = _G.numberOne
numberFieldEight = native.newTextField( 180, 80, 85, tHeight, onnumberFieldEight )
numberFieldEight.font = native.newFont( native.systemFontBold, inputFontSize )
numberFieldEight.align = “center”
numberFieldEight.inputType = “number”
– Add fields to our new group
localGroup:insert(numberFieldSeven)
localGroup:insert(numberFieldEight)
–>MUST return a display.newGroup()
–> This is how we end every file except for director and main, as mentioned in my first comment
return localGroup
end[/lua] [import]uid: 72372 topic_id: 14012 reply_id: 51626[/import]