Here you go dude, didn’t work in my simulator at all:
-- pantalla de status display.setStatusBar(display.HiddenStatusBar); function main() showTitleScreen(); end --Mostrar Menu de titulo function showTitleScreen() --colocar todo el titulo de pantalla en un grupo de elemento tittleScreenGroup = display.newGroup(); --Display background image tittleScreen = display.newImage("imagenes/titulo.png", 0, 0, true); tittleScreen.x = \_W; tittleScreen.y = \_H; -- Mostrar los botones en imagenes playBtn = display.newImage("imagenes/playButton.png"); playBtn.x = \_W; playBtn.y = \_H + 50; playBtn.name = "playbutton"; -- insertar fondo y botones en el grupo titleScreenGroup:insert(titleScreen); titleScreenGroup:insert(playBtn); -- hacer el boton interactivo playBtn:addEventListener("tap", loadGame); end -- constantes \_H = display.contentHeight; \_W = display.contentWidth; mRand = math.random; o = 0; time\_remain = 10; time\_up = false; total\_orbs = 20; ready = false; -- sonido de carga que seran reproducidos local soundtrack = audio.loadStream("sonido/soundtrack.caf"); local pop\_sound = audio.loadSound("sonido/pop.caf"); local win\_sound = audio.loadSound("sonido/win.caf"); local fail\_sound = audio.loadSound("sonido/fail.caf"); --Menu principal local titleScreenGroup; local titleScreen; local playBtn; --Cajas de texto agrupadas local textBoxGroup; local textBox; local conditionDisplay; local messageText; local display\_txt = display.newText("Wait", 0, 0, native.systemFont, 16\*2); display\_txt.xScale = .5; display\_txt.yScale = .5; display\_txt:setReferencePoint(display.BottomLeftReferencePoint); display\_txt.x = 20; display\_txt.y = \_H-20; local countdowntxt = display.newText(time\_remain, 0, 0, native.systemFont, 16\*2); countdowntxt.xScale = .5 countdowntxt.yScale = .5; countdowntxt:setReferencePoint(display.BottomRightReferencePoint); countdowntxt.x = \_W-20; countdowntxt.y = \_H-20; local function winlose(condition) if(condition == "win") then display\_txt.text = "WIN!!"; elseif(condition == "fail") then display\_txt.text = "FAIL!!"; end end local function trackOrbs(obj) obj:removeSelf(); o = o-1; if (time\_up ~= true) then --Si todas las esferas son removidas de la pantalla if(o == 0) then audio.play(win\_sound); timer.cancel(gametmr); winlose("win"); end end end local function countDown(e) if(time\_remain == 10)then ready = true; display\_txt.text = "Go!!"; --audio.play(soundtrack, {loops=-1}); end time\_remain = time\_remain -1; countdowntxt.text = time\_remain; if(time\_remain == 0)then time\_up = true; if(o ~= 0)then audio.play(fail\_sound); display\_txt.text = "FAIL!!"; ready = false; end end end local function spawnOrb() local orb = display.newImageRect("imagenes/Blue\_orb.png", 45, 45,45,45); orb:setReferencePoint(display.CenterReferencePoint); orb.x = math.random(50, \_W-50); orb.y = mRand(50, \_H-50); function orb:touch(e) if(ready == true) then if(time\_up ~= true) then if(e.phase == "ended") then --reproducir sonido audio.play(pop\_sound); -- quitar orbs trackOrbs(self); end end end return true;
I found:
- function showTitleScreen() was spelt TittleScreen
- orb:setReferencePoint(display,CenterReferencePoint); should be orb:setReferencePoint(display . CenterReferencePoint); (DOT not COMMA)
- “imagenes/blue_orb.png” should be “imagenes/Blue_orb.png”
If yours ran in the sim then More than likely the B missing from Blue orb was the cause. The simulator doesn’t seem to care about this but your device WILL!! Caused me many scratches of my head before.
Hope this helps 