Okay I didn’t post code because I wasn’t sure what to post. It doesn’t happen every time but it could happen on any screen when it does happen. this is the coding from one screen. I just thought that using some things like global variables or something could cause it.
[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 screen5 = display.newImage (“screen5.png”)
localGroup:insert(screen5)
–> This sets Screen5
local house = display.newImage (“house.png”)
house.x = 45
house.y = 50
house.xScale = .5
house.yScale = .5
localGroup:insert(house)
–>This places the House
local function touchedHouse (event)
if (“ended” == event.phase) then
director:changeScene (“titlescreen”)
media.playEventSound( “click_x.caf” )
end
end
house:addEventListener (“touch”, touchedHouse)
local brain = display.newImage (“brain.png”)
brain.x = 165
brain.y = 390
brain.xScale = .4
brain.yScale = .4
localGroup:insert(brain)
–>This places the brain
local hiphop = display.newImage (“hiphop.png”)
hiphop.x = 80
hiphop.y = 385
hiphop.xScale = .4
hiphop.yScale = .4
localGroup:insert(hiphop)
–>This places Hiphop
local function touchedbrain (event)
if (“ended” == event.phase) then
director:changeScene (“screen6”)
media.playEventSound( “click_x.caf” )
_G.numberOne = numberFieldOne.text
end
end
brain:addEventListener (“touch”, touchedbrain)
local backbutton = display.newImage (“backbutton.png”)
backbutton.x = 270
backbutton.y = 50
backbutton.xScale = .4
backbutton.yScale = .4
localGroup:insert(backbutton)
local function touchedBackbutton (event)
if (“ended” == event.phase) then
director:changeScene (“screen4a”)
media.playEventSound( “click_x.caf” )
end
end
backbutton:addEventListener (“touch”, touchedBackbutton)
–>This places the backbutton
–>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[/lua] [import]uid: 72372 topic_id: 13781 reply_id: 50721[/import]