Am trying to do an App in Corona that will display list of topics/items in table view but i have been on it for over 2 weeks now, i cant get the list displayed on the App but its showing the last item on the list instead of listing all on the tableView
i have tried "listRec[event.index].name" in place of "listRec.name" but am getting an error, please help me
See my code below
local widget = require( "widget" )
listRec = {}
local nameData = {"System1","System2","System3","System4","System5","System6"
,"System7","System8","System9"}
local list = nil
local function loadData()
for x=1, #nameData do
listRec[x] = {}
listRec.name = nameData[x]
end
end
local function onRowRender( event )
-- Get reference to the row group
local row = event.row
local rowGroup = event.view
-- Cache the row "contentWidth" and "contentHeight" because the row bounds can change as children objects are added
local rowHeight = row.contentHeight
local rowWidth = row.contentWidth
local rowTitle = display.newText(row, listRec.name, 0, 0, nil, 35 )
rowTitle:setFillColor( 0 )
-- Align the label left and vertically centered
rowTitle.anchorX = 0
rowTitle.x = 10
rowTitle.y = rowHeight * 0.5
end --onRowRender
local function pageup()
-- Create the widget
tableView = widget.newTableView
{
top = 50,
height = screenHeightSB,
width = screenWidth,
onRowRender = onRowRender,
onRowTouch = onRowTouch,
listener = scrollListener
}
--Heading Outline
local heading = display.newText("Course Outline", 0,0, "Helvetica" or "native.systemFont", 40)
heading.x = centerX
heading.y = 25
end ---pageup
local function showRec()
-- Insert 40 rows
for i = 1, #listRec do
local rowHeight = 60
-- Insert a row into the tableView
tableView:insertRow{
rowHeight = rowHeight
}
end
end --- showRec
loadData()
pageup()
showRec()
You can modify your code as the following:
local function loadData()
for x=1, #nameData do
listRec[x] = {
name = nameData[x]
}
end
end
then inside the rowRender function you add
local idx = row.index
local rowTitle = display.newText(row, listRec[idx].name, 0, 0, nil, 35 )
That should do it I guess
Related
I'm trying to create a function that would choose one of four objects from a table that would then create it. Essentially what's meant to happen is if objects 1-3 are chosen they would be considered "regular" and the "player" would have to catch them while the fourth object is "special" and would take points away if caught.
here's the table
local objects = {
"object1",
"object2",
"object3",
"object4"
}
this is the code I'm using in place of what I want currently (mostly to make sure everything else in my code is working)
local function spawnObject()
object = display.newImage("images/object1.png")
object.x = math.random(screenLeft+ 30, screenRight-30)
object.y = screenTop-100
object.width = 100
object.height = 100
object.Number = 1
object.type = "regular"
object.score = 5
object.rotation = math.random(-20,20)
physics.addBody(object, "dynamic", {density =1, friction =1, bounce = .5})
end
Start with this...
local function spawnObject()
local objects = {
"object1",
"object2",
"object3",
"object4"
}
object = display.newImage("images/"..objects[math.random(3)]..".png")
object.x = math.random(screenLeft+ 30, screenRight-30)
object.y = screenTop-100
object.width = 100
object.height = 100
object.Number = 1
object.type = "regular"
object.score = 5
object.rotation = math.random(-20,20)
physics.addBody(object, "dynamic", {density =1, friction =1, bounce = .5})
end
...for choosing 1-3.
If you dont like math.random(3) you can do a table.remove(objects,1) 3 times so it is clear the 4th time is the special one.
But then have to be objects global ( outside function and not local ).
...you have to check for.
I have no idea why this is not working. I am trying to delete the numbers in the table one by one (the randomCheck picks a number from the table and I want to delete that exact number) when I press the button 'MyButton'
math.randomseed(os.time())
_X = display.contentCenterX
_Y=display.contentCenterY
local numbers = {1,2,3,4,5,6,7,8,9,10}
local randomCheck = numbers[ math.random( #numbers) ]
local text = display.newText(""..randomCheck.."",_X,_Y,"Helvetica",50)
function removeNumber()
for i = 1, 10 do
if(randomCheck == i ) then
table.remove(numbers,i)
text.text = (""..i.."")
end
end
end
myButton = display.newRect(_X,_Y+100,100,80 )
myButton:addEventListener("tap", removeNumber)
In your loop, instead of
if(randomCheck == i)
use
if(randomCheck == numbers[i])
But all of that work is really unnecessary.
Instead of
local randomCheck = numbers[math.random( #numbers)]
use
local randomIndex = math.random(#numbers)
local randomCheck = numbers[randomIndex]
Then you can just
table.remove(numbers, randomIndex)
It looks like I am having problems with transitioning from my level select page to my first level. I think it might be that I am missing something in my level 1, but I don't know exactly.
levelSelect.lua
module(..., package.seeall)
local director = require ("director")
local physics = require("physics")
physics.start()
local widget = require( "widget" )
-- Function to handle button events
local function handleButtonEventLevel1( event )
local phase = event.phase
if "ended" == phase then
director:changeScene("lvl1")
end
end
--local function goLevel1()
--director:changeScene("lvl1")
--return true
--end
--widget.newButton:addEventListener("tap", goLevel1)
local function handleButtonEventToPage( event )
local phase = event.phase
if "ended" == phase then
director:changeScene("page")
end
end
-- Main function - MUST return a display.newGroup()
function new()
local localGroup = display.newGroup()
local background = display.newImage("bigtestsky.png")
background.x=150
background.y=250
local myButton = widget.newButton
{
left = 25,
top = 25,
width = 100,
height = 50,
defaultFile = "default.png",
overFile = "over.png",
label = "1",
font = "LS",
fontSize = 20,
labelColor = { default = {0,0,50}, over = {0,0,255} },
onEvent = handleButtonEventLevel1,
}
local myButton = widget.newButton
{
left = 25,
top = 415,
width = 100,
height = 50,
defaultFile = "default.png",
overFile = "over.png",
label = "BACK",
font = "LS",
fontSize = 20,
labelColor = { default = {0,0,50}, over = {0,0,255} },
onEvent = handleButtonEventToPage,
}
return localGroup
end
lvl1.lua
local physics = require("physics")
physics.start()
local widget = require( "widget" )
(This is what I mean about missing something in the first level. Could someone please help?)
stack traceback:
[C]: ?
.../myName/Desktop/Bubbles! App/director.lua:116: in function 'loadScene'
.../myName/Desktop/Bubbles! App/director.lua:394: in function 'changeScene'
...myName/Desktop/Bubbles! App/levelSelect.lua:14: in function '_onEvent'
?: in function '?'
?: in function <?:405>
?: in function <?:218>
These are due to some issues with your class: lvl1.lua.
If such error occurs, open director.lua analyse the error return line. This will help you to find what the real problem is.
Here, you must write more lines in your lvl1.lua as below:
module(...,package.seeall) -- If this line is not written, then the package will not be loaded.
function new() -- Module 'lvl1' must have a new() function
local localGroup = display.newGroup() -- The scene should create a display group
local physics = require("physics")
physics.start()
local widget = require( "widget" )
print("Inside lvl1...")
return localGroup; -- And the scene should return the previously created display group.
end
Keep Coding.............. :)
I have been modifying code from the memory match game to use scenes, sounds, and a 2d table. Adding the scenes has been the hard part. I have it set up to randomly select items from my 2d table. Load those into a temporary table, shuffle them shuffle(), then boardSet(); to load their sounds and place them on the screen. Basically after the game is over I want the scene to reload or go back to the menu to start again. Selecting random data{} elements over and over.
I have tried returning to the menu, or going to a duplicate scene however I can't seem to correctly unload the objects created by my 2d array, as I can't properly add each item into a display group. I have tried everything I can think of. Right now my game loop is setup to add the play again btn that I want to restart the game after one match is found.
This link was a start in the right direction I believe with information about dealing with tables and groups. I still don't know how to cycle thru my 2d table to include everything in a group and then properly unload it.
http://developer.coronalabs.com/content/application-programming-guide-graphics-and-drawing#Variable_References
---------------------------------------------------------------------------------
--
-- level1.lua
--
---------------------------------------------------------------------------------
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
local widget = require "widget"
---------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------
local image, text1, text2, text3, memTimer
-- forward declarations and other locals
local againBtn
-- 'onRelease' event listener for playBtn
local function onPlayBtnRelease()
-- go to level1.lua scene
storyboard.gotoScene( "menu", "fade", 500 )
return true -- indicates successful touch
end
-- Preload the sound file (needed for Android)
--
local playBeep = function( testSound )
media.playEventSound( testSound )
end
---Preload sounds
ki = audio.loadSound("ki-nawaneyoo.mp3")
u = audio.loadSound("u.mp3")
mayuhoo = audio.loadSound("mayuhoo.mp3")
--End Sound Test
--Set Global width and height variables
_W = display.contentWidth;
_H = display.contentHeight;
---Count number of correct matches
local matchCount = 0;
--Hide status bar
display.setStatusBar(display.HiddenStatusBar);
--Declare a totalButtons variable to track number of buttons on screen
local totalButtons = 0
--Declare variable to track button select
local secondSelect = 0
local checkForMatch = false
--Declare Data Table
local data = {}
--Load objects into data
data[1] = {}
data[1].title = "Naka"
data[1].subtitle = "a"
data[1].image = "a.png"
data[1].image1 = "ear.png"
data[1].sound = "naka-ear.caf"
data[1].sound1 = "naka-ear.mp3"
data[2] = {}
data[2].title = "Aapuhu"
data[2].subtitle = "aa"
data[2].image = "aa.png"
data[2].image1 = "eyebrow.png"
data[2].sound = "aapuhu-eyebrow.caf"
data[2].sound1 = "aapuhu-eyebrow.mp3"
data[3] = {}
data[3].title = "Ego"
data[3].subtitle = "Ego"
data[3].image = "e.png"
data[3].image1 = "tongue.png"
data[3].sound = "ego-tongue.caf"
data[3].sound1 = "ego-tongue.mp3"
data[4] = {}
data[4].title = "Kamoo"
data[4].subtitle = "kamoo"
data[4].image = "ee.png"
data[4].image1 = "chin.png"
data[4].sound = "kamoo-chin.caf"
data[4].sound1 = "kamoo-chin.mp3"
data[5] = {}
data[5].title = "Kowpa"
data[5].subtitle = "ego"
data[5].image = "leg.png"
data[5].image1 = "leg.png"
data[5].sound = "kowpa-leg.caf"
data[5].sound1 = "kowpa-leg.mp3"
data[6] = {}
data[6].title = "Mae"
data[6].subtitle = "kwa"
data[6].image = "hand.png"
data[6].image1 = "hand.png"
data[6].sound = "mae-hand.caf"
data[6].sound1 = "mae-hand.mp3"
data[7] = {}
data[7].title = "Nodo"
data[7].subtitle = "kwe"
data[7].image = "kwe.png"
data[7].image1 = "throat.png"
data[7].sound = "nodo-throat.caf"
data[7].sound1 = "nodo-throat.mp3"
data[8] = {}
data[8].title = "Matogo"
data[8].subtitle = "kwe"
data[8].image = "kwe.png"
data[8].image1 = "thumb.png"
data[8].sound = "matogo-thumb.caf"
data[8].sound1 = "matogo-thumb.mp3"
data[9] = {}
data[9].title = "Matzehe"
data[9].subtitle = "kwe"
data[9].image = "kwe.png"
data[9].image1 = "elbow.png"
data[9].sound = "matzehe-eblow.caf"
data[9].sound1 = "matzehe-elbow.mp3"
data[10] = {}
data[10].title = "Kuku"
data[10].subtitle = "kwe"
data[10].image = "kwe.png"
data[10].image1 = "foot.png"
data[10].sound = "kuku-foot.caf"
data[10].sound1 = "kuku-foot.mp3"
--Declare button, buttonCover, and buttonImages table
local tableCopy = {}
local buttonImages = {}
--Shuffle data table
--local shuffleSet = function()
--Shuffle data table
math.randomseed (os.time())
local function shuffle(a)
local n = #a
local t
local k
while(n > 0) do
t = a[n]
k = math.random(n)
a[n] = a[k]
a[k] = t
n = n - 1
end
return a
end
local tableCopy = shuffle(data);
local button = {}
local buttonCover = {}
--Choose six random objects from data to be used in game.
local firstSix = {}
for i = 1,6 do
firstSix[i] = tableCopy[i];
end
local buttonImages = {firstSix[1],firstSix[1],firstSix[2],firstSix[2],firstSix[3],firstSix[3],firstSix[4],firstSix[4],firstSix[5],firstSix[5],firstSix[6],firstSix[6]}
--end
--Declare and prime a last button selected variable
local lastButton;-- = display.newImage("1.png");
--lastButton.myName = 1;
--
--Set up simple off-white background
--Notify player if match is found or not
local matchText = display.newText(" ", 0, 0, native.systemFont, 65)
matchText:setReferencePoint(display.CenterReferencePoint)
matchText:setTextColor(255, 255, 255)
matchText.x = _W/2
--
--Set starting point for button grid
local x = -20
local matchesFound = 0;
--Set up game function
local function game(object, event)
if(event.phase == "began") then
if(checkForMatch == false and secondSelect == 0) then
--Flip over first button
buttonCover[object.number].isVisible = false;
audio.play(object.sound);
lastButton = object
checkForMatch = true
elseif(checkForMatch == true and object.number ~= lastButton.number) then
if(secondSelect == 0) then
--Flip over second button
buttonCover[object.number].isVisible = false;
secondSelect = 1;
--If buttons do not match, flip buttons over
if(lastButton.myName ~= object.myName) then
audio.play(object.sound);
timer.performWithDelay(1000,function()
matchText.text = "Ki Nawa'neyoo";
audio.play(ki); end,1)
timer.performWithDelay(2500, function()
matchText.text = " ";
checkForMatch = false;
secondSelect = 0;
buttonCover[lastButton.number].isVisible = true;
buttonCover[object.number].isVisible = true;
end, 1)
--If buttons DO match, remove buttons
elseif(lastButton.myName == object.myName) then
matchText.text = "U " .. object.myName .. " Mayuhoo";
audio.play(u)
timer.performWithDelay(750,function()
audio.play(object.sound); end, 1)
timer.performWithDelay(1500,function()
audio.play(mayuhoo); end, 1)
timer.performWithDelay(2400, function()
matchText.text = " ";
checkForMatch = false;
secondSelect = 0;
lastButton:removeSelf();
object:removeSelf();
buttonCover[lastButton.number]:removeSelf();
buttonCover[object.number]:removeSelf();
matchesFound = matchesFound + 1;
timer.performWithDelay(250, function()
if (matchesFound == 1) then
matchText.text = " Play Again? ";
againBtn.isVisible = true;
-- all display objects must be inserted into group
--group:insert( playBtn )
end
end, 1)
end, 1)
end
end
end
end
end
--]]
-- Touch event listener for background image
--[[
local function onSceneTouch( self, event )
if event.phase == "began" then
storyboard.gotoScene( "scene2", "slideLeft", 800 )
return true
end
end
--]]
-- Called when the scene's view does not exist:
function scene:createScene( event )
local screenGroup = self.view
local image = display.newImageRect( "bg.png", display.contentWidth, display.contentHeight )
image:setReferencePoint( display.TopLeftReferencePoint )
image.x, image.y = 0, 0
screenGroup:insert( image )
local function boardSet()
for count = 1,3 do
x = x + 100 * 2
y = 20 *2
for insideCount = 1,4 do
y = y + 90 * 2
--Assign each image a random location on grid
local temp = math.random(1,#buttonImages)
button[count] = display.newImageRect(buttonImages[temp].image1, 150, 150);
--Position the button
button[count].x = x;
button[count].y = y;
--Give each a button a name
button[count].myName = buttonImages[temp].title
-- Preload the sound file (needed for Android)
--Give each button a sounds
soundID = audio.loadSound(buttonImages[temp].sound1)
button[count].sound = soundID
button[count].sound1 = soundID
button[count].number = totalButtons
--Remove button from buttonImages table
table.remove(buttonImages, temp)
--Set a cover to hide the button image
buttonCover[totalButtons] = display.newImageRect("button.png", 150, 150);
buttonCover[totalButtons].x = x; buttonCover[totalButtons].y = y;
--screenGroup:insert(button[count].)
totalButtons = totalButtons + 1
--Attach listener event to each button
button[count].touch = game
button[count]:addEventListener( "touch", button[count] )
end
end
end
boardSet();
end
-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
againBtn = widget.newButton{
label="Play Again?",
fontSize = 25,
labelColor = { default={255}, over={128} },
default="button1.png",
over="button-over.png",
width=250, height=100,
onRelease = onPlayBtnRelease -- event listener function
}
againBtn:setReferencePoint( display.CenterReferencePoint )
againBtn.x = display.contentWidth * 0.5
againBtn.y = display.contentHeight - 125
againBtn.isVisible = false
print( "1: enterScene event" )
-- remove previous scene's view
end
-- Called when scene is about to move offscreen:
function scene:exitScene( event )
print( "1: exitScene event" )
if againBtn then
matchText.text = " "
againBtn:removeSelf() -- widgets must be manually removed
button = nil
buttonCover = nil
firstSix = nil
data = nil
tableCopy = nil
buttonImages = nil
againBtn = nil
end
end
-- Called prior to the removal of scene's "view" (display group)
function scene:destroyScene( event )
local screenGroup = self.view
storyboard.removeScene();
--storyboard.purgeScene( "level1" )
print( "((destroying scene 1's view))" )
end
---------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------
-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )
-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )
-- "exitScene" event is dispatched before next scene's transition begins
scene:addEventListener( "exitScene", scene )
-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )
---------------------------------------------------------------------------------
return scene
Yeah, this is simple.
here is an example(assuming that you have implemented storyboard)
function scene:createScene(event)
screenGroup = self.view
local image = display.newImage("image.png")
screenGroup:insert(image)
end
Now everything will go fine :)
Add all the display objects to a group.local myGroup = display.newGroup();
local img = display.newImage("yourimage.png");
myGroup:insert(img);
For example
If you follow this method, all display objects will not be flushed out of memory when you change the screen.
When using corona storyboard you need to add display objects to the group. For example you would need to add all of your display objects into screenGroup in order for them to be removed when you change scenes.
I am new to game development and I am trying to create a simply GUI framework for my current project. I am currently using the Director Class 1.4 for my scene management. I have got my project o change scenes, but now I want to create a pop up window. I just want the pop up window to show up over the current scene I'm on. Below is the code for my main.lua and menu.lua (my initial scene). If anyone could help me out, I would really appreciate it. Please try to be as specific as possible, because I am very new to Corona and programming in general.
main.lua
_W = display.contentWidth
_H = display.contentHeight
local director = require ("director");
local mainGroup = display.newGroup();
local function main()
mainGroup:insert(director.directorView);
director:changeScene("menu");
return true;
end
main();
menu.lua
module(..., package.seeall)
function new()
local localGroup = display.newGroup();
local bg = display.newImage("Images/background1.PNG");
local myText = display.newText("Merchant", 0, 0, native.systemFont, 24)
myText:setTextColor(255, 255, 255)
myText:setReferencePoint(display.CenterReferencePoint);
myText.x = _W/2; myText.y = _H/2;
local hero_btn = display.newImage("Images/weaponcraft.PNG", 25, 25);
hero_btn:setReferencePoint(display.BottomLeftReferencePoint);
hero_btn.x = 252; hero_btn.y = 475;
hero_btn.scene = "heroMain";
local craft_btn = display.newImage("Images/smithing.PNG", 25, 25);
craft_btn:setReferencePoint(display.BottomLeftReferencePoint);
craft_btn.x = 7; craft_btn.y = 475;
craft_btn.scene = "craftMain";
local inventory_btn = display.newImage("Images/inventory1.png");
inventory_btn:setReferencePoint(display.CenterReferencePoint);
inventory_btn.x = _W/2; inventory_btn.y = 430;
--inventory_btn.scene = "inventory";
function changeScene(e)
if(e.phase == "ended") then
director:changeScene(e.target.scene);
end
end
localGroup:insert(bg);
localGroup:insert(hero_btn);
localGroup:insert(craft_btn);
hero_btn:addEventListener("touch", changeScene);
craft_btn:addEventListener("touch", changeScene);
return localGroup;
end
You can use the native.showAlert function. This shows a popup dialog box.
Something like this:
local function onComplete( event )
local action = event.action
if "clicked" == event.action then
if 1 == event.index then
end
end
local alert = native.showAlert( "You are in scene1!", "Congratulations!", { "OK" }, onComplete )
This show a dialog box with a "You are in scene1!" title, "Congratulations!" subtitle, and a "OK" button that closes the dialog box when you click(or tap) it.
Put these code in the front of your scene, and change the native.showAlert properties to the words you want.
You can create your custom pop up and can handle it by your own I am putting the sample code.
--function to create a dialog to be shown on the game over
local function gameOverAlertScreen()
--Display item used in the popup screen
local alertBox , restartBtn, levelBtn, soundOnOffSwitch, quitOnOffSwitch, imageSheetSoundOnOff, imageSheetQuitOnOff
--initial constans used for positioning the display items
local startTX = -400
local startTY = halfH
local btnInitailY = halfH -50
local btnMargin = 10
--cancel the game pausse timer
if(gameTimer_main) then
timer.cancel(gameTimer_main)
gameTimer_main = nil
end
local optionSoundSheet =
{
-- The params below are required
width = 51,height = 51,numFrames = 2,-- The params below are optional; used for dynamic resolution support
sheetContentWidth = 102, -- width of original 1x size of entire sheet
sheetContentHeight = 51 -- height of original 1x size of entire sheet
}
local optionQuitSheet =
{
-- The params below are required
width = 51,height = 51,numFrames = 2,-- The params below are optional; used for dynamic resolution support
sheetContentWidth = 102, -- width of original 1x size of entire sheet
sheetContentHeight = 51 -- height of original 1x size of entire sheet
}
isFirstTime=true
--pauseScreen()
dialog=true
alertBox = display.newImage("image/popup_dialog.png")
alertBox.x = halfW; alertBox.y = halfH
alertBox:setReferencePoint(display.CenterReferencePoint)
--creating the restart button fot the popup dialog
restartBtn = widget.newButton{
defaultFile="image/replay_btn.png",overFile = "image/replay_btn_hover.png",
isEnable=true,onRelease = onReplayBtnGameOverRelease -- event listener function
}
restartBtn.x = halfW
restartBtn.y = btnInitailY
--creating the level button
levelBtn = widget.newButton{
defaultFile="image/menu.png",overFile = "image/menu_hover.png",
isEnable=true, onRelease = onLevelBtnGameOverRelease -- event listener function
}
levelBtn.x = halfW
levelBtn.y = restartBtn.y + restartBtn.height + btnMargin
--creating the sound on off switch
imageSheetSoundOnOff = graphics.newImageSheet( "image/sound.png", optionSoundSheet )
soundOnOffSwitch = widget.newSwitch
{
left = screenW * 0.18,top = screenH * 0.73, style = "checkbox", sheet = imageSheetSoundOnOff,
initialSwitchState = soundOn,frameOff = "2",frameOn = "1",onRelease = onSoundButtonClicked, onPress = onSoundButtonClicked,
}
--creating the quit on off switch
imageSheetQuitOnOff = graphics.newImageSheet( "image/vibration.png", optionQuitSheet )
quitOnOffSwitch = widget.newSwitch
{
left = screenW * 0.7,top = screenH * 0.735,style = "checkbox",sheet = imageSheetQuitOnOff,onPress = onViberationButtonClicked,
initialSwitchState = vibrationOn,frameOff = "2",frameOn = "1",
}
--soundOnOffSwitch:setState({ isOn = soundOn })
--quitOnOffSwitch:setState({ isOn = vibrationOn})
--create/position logo/title image on upper-half of the screen
local titleLogo = display.newImageRect( "image/gameover.png",144,30)
titleLogo:setReferencePoint( display.CenterReferencePoint )
titleLogo.x = halfW
titleLogo.y = btnInitailY - 65
if popupGameOverGroup == nil then
popupGameOverGroup = display.newGroup()
end
-- inserting the buttons and the alert dialog to the popup group
popupGameOverGroup:insert(alertBox)
popupGameOverGroup:insert(restartBtn)
popupGameOverGroup:insert(levelBtn)
popupGameOverGroup:insert(soundOnOffSwitch)
popupGameOverGroup:insert(quitOnOffSwitch)
popupGameOverGroup:insert(titleLogo)
transition.from(popupGameOverGroup, {time =1000,x=startTX,y=titleLogo.y,xScale = 1, yScale = 1,
transition = easing.inOutExpo})
localGroup:insert(popupGameOverGroup)
showAdd()
end