I have an iOS app on the app store called Beach Ball Burst!. I recently release an update for the app, it passed Apple’s App Tests but when I went to play it my iPhone I got a popup. It was a director class error. " Director ERROR: Failed to excite new(params) function on Easy_Level " I tried to reproduce this in the simulator and did not get the same result. Then I tried installed the app onto my iPhone, same thing. I did not get an error. Only the app store version gets the error, and the code has not been changed at all. Don’t know what to do. Any ideas?
Here the code, it’s very long:
[code]
module(…, package.seeall);
function clean()
Runtime:removeEventListener( “system”, activatepause )
end
function new()
local Scene = display.newGroup();
–Setup of Groups
local gameground = display.newGroup();
local GUI = display.newGroup();
–load Physics
local physics = require(“physics”);
physics.start( true );
physics.setGravity(0,9.8)
–Vars
local spikesright = {};
local spikesleft = {};
local _score = 0
local pops_sound = audio.loadSound(“media/Pops.caf”)
local pauseon = false
local pausetitle
–Classes
local spikeleft = require(“spikeleft”);
local spikeright = require(“spikeright”);
local ego = require “ego”
local saveFile = ego.saveFile
local loadFile = ego.loadFile
–sounds
soundswitch = loadFile (“soundswitch.txt”)
if(soundswitch == “1”) then
soundtrack = audio.loadStream(“media/GameSoundtrack.caf”);
audio.play(soundtrack, {loops = -1, channel = 2})
end
–Spike Removal Walls
local right_wallD= display.newRect(400, 0, 1, display.contentHeight)
right_wallD.type = “wall”
local left_wallD= display.newRect(-100, 0, 1, display.contentHeight)
left_wallD.type = “wall”
left_wallD.isVisible = false
local right_wallS = display.newRect(400, 0, 1, display.contentHeight)
local left_wallS = display.newRect(-100, 0, 1, display.contentHeight)
left_wallS.isVisible = false
physics.addBody(right_wallD, “dynamic”)
physics.addBody(left_wallD, “dynamic”)
physics.addBody(right_wallS, “static”)
physics.addBody(left_wallS, “static”)
physics.newJoint(“weld”, right_wallS, right_wallD, 400,0)
physics.newJoint(“weld”, left_wallS, left_wallD, -100,0)
right_wallD.isSensor = true
left_wallD.isSensor = true
gameground:insert(right_wallD)
gameground:insert(left_wallD)
gameground:insert(right_wallS)
gameground:insert(left_wallS)
–Background Image
if _G.isTall == true then
local bg_image = display.newImageRect(“Game_Images/sand-five.png”, 320, 568);
bg_image:setReferencePoint(display.TopLeftReferencePoint);
bg_image.x = 0
bg_image.y = 0
gameground:insert(bg_image)
else
local bg_image = display.newImageRect(“Game_Images/sand.png”, 320, 480);
bg_image:setReferencePoint(display.TopLeftReferencePoint);
bg_image.x = 0
bg_image.y = 0
gameground:insert(bg_image)
end
–Insert Ceiling
local ceiling = display.newImageRect(“Game_Images/orangetop.png”, 320, 55);
ceiling:setReferencePoint(display.TopLeftReferencePoint);
ceiling.x = 0
ceiling.y = 0
ceiling.type = “wall”
physics.addBody(ceiling, “static”, {bounce = 0.1} )
gameground:insert(ceiling)
– Pausing
local pause_btn = display.newText(“ll”, 0,0, “Medrano”, 40)
pause_btn:setReferencePoint(display.TopRightReferencePoint)
pause_btn.x = _W - 10
pause_btn.y = 0
pause_btn:setTextColor(0,0,0)
gameground:insert(pause_btn)
function startpause()
if(pauseon == false) then
physics.pause()
timer.pause(scoretimer)
timer.pause(tmrL)
timer.pause(tmrR)
audio.stop(2)
pauseon = true
pausetitle = display.newText(“Resume”, 0,0, “GoodDog”, 80)
pausetitle.x = _W * 0.5
pausetitle.y = _H * 0.55
pausetitle:setTextColor( 249, 54, 15)
GUI:insert(pausetitle)
pause_btn:removeEventListener(“tap”, startpause)
pausetitle:addEventListener(“tap”, endpause)
end
end
function endpause()
display.remove(pausetitle)
pausetitle = nil
timer.resume(scoretimer)
timer.resume(tmrL)
timer.resume(tmrR)
pauseon = false
pause_btn:addEventListener(“tap”, startpause)
if(soundswitch == “1”) then
soundtrack = audio.loadStream(“media/GameSoundtrack.caf”);
audio.play(soundtrack, {loops = -1, channel = 2})
end
timer.performWithDelay(80, startphysics,1)
end
function startphysics()
physics.start(false)
end
pause_btn:addEventListener(“tap”, startpause)
function activatepause(event,pauseon)
if (event.type == “applicationSuspend”) then
startpause();
end
end
Runtime:addEventListener( “system”, activatepause )
–Score System
local function ScoreSystem()
local score_txt = display.newText("Score: ", 0,0, “GoodDog”, 55);
score_txt:setReferencePoint(display.TopLeftReferencePoint);
score_txt.x = 7
score_txt.y = -2
local score = display.newText(" " … _score, 0, 0, “Medrano”, 43);
score:setReferencePoint(display.TopLeftReferencePoint);
score.x = score_txt.x + 103
score.y = score_txt.y + 2
score_txt:setTextColor(0,0,0)
score:setTextColor(0,0,0)
gameground:insert(score_txt)
gameground:insert(score)
local function addscore ()
score:removeSelf()
score = nil
_score = _score + 1
score = display.newText(" " … _score, 0, 0, “Medrano”, 43);
score:setReferencePoint(display.TopLeftReferencePoint);
score.x = score_txt.x + 103
score.y = score_txt.y + 2
score:setTextColor(0,0,0)
gameground:insert(score)
end
scoretimer = timer.performWithDelay(1000, addscore, -1)
end
–Insert Beach Ball Walls
local leftWall = display.newRect(-2,0,1,_H)
leftWall.type = “wall”
local rightWall = display.newRect(_W + 1,0,1,_H)
rightWall.type = “wall”
local floor = display.newRect(0,_H + 1, _W, 1)
floor.type = “floor”
physics.addBody(leftWall, “static”, {bounce = 0.1} )
physics.addBody(rightWall, “static”, {bounce = 0.1} )
physics.addBody(floor, “static” , {bounce = 0.1, friction = 1.0} )
gameground:insert(leftWall)
gameground:insert(rightWall)
gameground:insert(floor)
–Insert Beach Ball
local ball = display.newImageRect(“Game_Images/beachball.png”,80,80)
ball.x = _W * 0.5
ball.y = _H * 0.5
physics.addBody(ball, { bounce = 0.5, radius = 45, friction = 1.0, radius = 39} )
ball:addEventListener(“collision”, ball)
ball.isBullet = true
gameground:insert(ball)
–Beach Ball Controls
function moveball(event)
motion1 = (event.x - ball.x) * -1 * 0.008;
motion2 = (event.y - ball.y) * -1 * 0.008;
ball:applyLinearImpulse ( motion1, motion2, event.x, event.y)
ball:removeEventListener(“touch”, moveball)
moveball_timer = timer.performWithDelay(100, moveballstart, 1)
end
function moveballstart()
ball:addEventListener(“touch”, moveball)
end
–Spawning Spikes
local function spawnSpikeLeft()
local function spawnLS(e)
local LS = spikeleft.newSpikeLeft();
spikesleft[LS] = LS;
spikesleft[LS].x = -30
if _G.isTall == true then
spikesleft[LS].y = math.random(90,540)
else
spikesleft[LS].y = math.random(80,455)
end
gameground:insert(spikesleft[LS]);
end
local function spawnFLS(e)
local FLS = spikeleft.newSpikeLeft();
spikesleft[FLS] = FLS;
spikesleft[FLS].x = -30
if _G.isTall == true then
spikesleft[FLS].y = 540
else
spikesleft[FLS].y = 455
end
gameground:insert(spikesleft[FLS]);
end
tmrL = timer.performWithDelay(8000, spawnLS, 0)
tmrFL= timer.performWithDelay(20000, spawnFLS, 0)
end
local function spawnSpikeRight()
local function spawnRS(e)
local RS = spikeright.newSpikeRight();
spikesright[RS] = RS;
spikesright[RS].x = _W + 30
if _G.isTall == true then
spikesright[RS].y = math.random(90,540)
else
spikesright[RS].y = math.random(80,455)
end
gameground:insert(spikesright[RS]);
end
local function spawnFRS(e)
local FRS = spikeright.newSpikeRight();
spikesright[FRS] = FRS;
spikesright[FRS].x = _W + 30
if _G.isTall == true then
spikesright[FRS].y = 540
else
spikesright[FRS].y = 455
end
gameground:insert(spikesright[FRS]);
end
tmrR = timer.performWithDelay(8000, spawnRS, 0)
tmrFR = timer.performWithDelay(20000, spawnFRS, 0)
end
–End Game
function ball:collision(e)
if(e.phase == “began”) then
if(e.other.type == “spike”) then
display.remove( ball )
timer.cancel(scoretimer)
timer.cancel (tmrL)
timer.cancel (tmrR)
timer.cancel (tmrFR)
timer.cancel (tmrFL)
pause_btn:removeEventListener(“tap”, startpause)
clean();
if(soundswitch == “1”) then
audio.stop(2)
audio.play(pops_sound)
end
local function gameover()
if _G.isTall == true then
local bg_lose = display.newImageRect(“Game_Images/orangerounded-five.png”, 260, 450 )
bg_lose:setReferencePoint(display.CenterReferencePoint);
bg_lose.x = _W * 0.5
bg_lose.y = _H * 0.56
GUI:insert(bg_lose)
else
local bg_lose = display.newImageRect(“Game_Images/orangerounded.png”, 260, 400)
bg_lose:setReferencePoint(display.CenterReferencePoint);
bg_lose.x = _W * 0.5
bg_lose.y = _H * 0.56
GUI:insert(bg_lose)
end
local lose_title = display.newText(“Game Over”, 0,0, “Medrano”, 43)
lose_title.x = _W * 0.5
lose_title.y = _H * 0.23
lose_title:setTextColor( 249, 54, 15)
local yourscore = display.newText(“Your Score:”, 0,0, “Medrano”,38)
yourscore.x = _W * 0.5
yourscore.y = _H * 0.38
yourscore:setTextColor( 252, 126, 27 )
local dscore = display.newText(""… _score , 0,0, “Medrano”,60)
dscore.x = _W * 0.5
dscore.y = _H * 0.52
dscore:setTextColor(32, 230, 12)
local GameCenter_btn = display.newText(“Submit To:”, 0, 0,“Medrano”, 38)
GameCenter_btn.x = _W * 0.5
GameCenter_btn.y = _H * 0.67
GameCenter_btn:setTextColor(29, 29, 255)
local GameCenter_btn2 = display.newText(“Game Center”, 0, 0,“Medrano”, 38)
GameCenter_btn2.x = _W * 0.5
GameCenter_btn2.y = _H * 0.75
GameCenter_btn2:setTextColor(29, 29, 255)
local Menu_btn = display.newText(“Menu”, 0, 0, “Medrano”, 45)
Menu_btn.x = _W * 0.5
Menu_btn.y = _H * 0.89
Menu_btn:setTextColor(249, 54, 15)
Menu_btn.scene = “Main_Menu”
GUI:insert(lose_title)
GUI:insert(yourscore)
GUI:insert(dscore)
GUI:insert(Menu_btn)
GUI:insert(GameCenter_btn)
GUI:insert(GameCenter_btn2)
local function changeScene(e)
if(e.phase == “ended” or e.phase == “cancelled”) then
audio.stop(2)
director:changeScene(e.target.scene);
end
end
local function submitgamecenter()
if loggedIntoGC then
gameNetwork.request( “setHighScore”, { localPlayerScore={ category= “beachballburst.easy”, value=_score }, listener=requestCallback } );
native.showAlert( “Success!”, “Score Reported To Game Center”, { “OK” } )
GameCenter_btn:removeEventListener(“tap”, submitgamecenter)
GameCenter_btn2:removeEventListener(“tap”,submitgamecenter)
GameCenter_btn:setTextColor(120,120,120)
GameCenter_btn2:setTextColor(120,120,120)
else
native.showAlert( “Game Center Offline”, “Please check your internet connection or login to Game Center.”, { “OK” } )
end
end
GameCenter_btn:addEventListener(“tap”, submitgamecenter)
GameCenter_btn2:addEventListener(“tap”,submitgamecenter)
Menu_btn:addEventListener(“touch”, changeScene)
end
timer.performWithDelay(1000, gameover, 1)
end
end
end
spawnSpikeLeft();
spawnSpikeRight();
ScoreSystem();
moveballstart();
Scene:insert(gameground);
Scene:insert(GUI);
return Scene
end [import]uid: 170397 topic_id: 33279 reply_id: 333279[/import]