Hello there guys and girls,
I’m a new member, I’m creating a classic shooter game in Corona but
problem is that, whatever I have tried so far (with my current knowledge on Lua won’t fix the restart issue…does anybody know what the problem is ?
The exact problem:
It goes like this:
1)the player loses
2) the pop-up screen that shows the “GAME LOST-Tap to restart” screen is shown
3)the player taps the screen, and he is redirected to the main menu again
all smoothly up until this moment, but afterwards when the player presses “PLAY” again, the game is starting normally (score zeroed, 3 lives etc), I can move the spaceship, I can also fire bullets, and one single enemy appears too, BUT, the bullets do NOT travel towards the top of the screen, and enemies do not move towards the bottom of the screen ! although for a strange reason the background is scrolling !!! the sea is travelling, and the code that does that is called in the first line of my “update” function !
The error I get is the following:
"main.lua:458: attempt to index value ‘bullets’ a nil value
screenshots of the frames before and after the restart:
http://img402.imageshack.us/img402/6339/problem01j.jpg
Here I attach my code:
[lua]–Inserting the sprite library
require “sprite”
– Hides the phones “Status Bar”
display.setStatusBar(display.HiddenStatusBar)
– Import the MovieClip Library into the local variable movieclip
local movieclip = require(‘movieclip’)
– Import Physics parameters into the local variable physics
local physics = require(‘physics’)
physics.start()
physics.setGravity(0, 0)
– Pause variable
local paused = false
local restart01 = false
– Textures/graphics are cahced in memory here for quick loading
local textureCache = {}
textureCache[1] = display.newImage(‘bg.png’);
textureCache[2] = display.newImage(‘title.png’)
textureCache[3] = display.newImage(‘playButton.png’)
textureCache[4] = display.newImage(‘creditsButton.png’)
textureCache[5] = display.newImage(‘creditsView.png’)
–[[textureCache[6] = display.newImage(‘heliA.png’)
textureCache[7] = display.newImage(‘heliB.png’)
–]]
textureCache[8] = display.newImage(‘live.png’)
textureCache[9] = display.newImage(‘bullet.png’)
textureCache[10] = display.newImage(‘enemyA.png’)
textureCache[11] = display.newImage(‘enemyB.png’)
textureCache[12] = display.newImage(‘hardEnemyA.png’)
textureCache[13] = display.newImage(‘hardEnemyB.png’)
textureCache[14] = display.newImage(‘youWon.png’)
textureCache[15] = display.newImage(‘gameOver.png’)
textureCache[16] = display.newImage(‘bossA.png’)
textureCache[17] = display.newImage(‘bossB.png’)
textureCache[18] = display.newImage(‘Splash lvl2.png’)
–SpriteSheet variables
local sheet1 = sprite.newSpriteSheet(“railgunsheet.png”, 34, 76)
local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 4)
–local instance = sprite.newSprite(spriteSet1)
local heliSpriteSheet = sprite.newSpriteSheet(“helisheet.png”, 72, 79)
local spriteSet2 = sprite.newSpriteSet(heliSpriteSheet, 1, 4)
local heliSpriteSheet2 = sprite.newSpriteSheet(“helisheet2.png”, 72, 79)
local spriteSet3 = sprite.newSpriteSet(heliSpriteSheet2, 1, 4)
local bgSpriteSheet = sprite.newSpriteSheet(“bgsheet.png”, 320, 480)
local spriteSet3 = sprite.newSpriteSet(bgSpriteSheet, 1, 10)
– Background image load
local bg = display.newImage(‘bg.png’)
bg:setReferencePoint(display.TopLeftReferencePoint);
bg.y = -960
local bgOnTop = display.newImage(‘bgOnTop.png’)
bgOnTop:setReferencePoint(display.TopLeftReferencePoint);
– Parallax needed variables
_W = display.contentWidth; --Returns Screen Width
_H = display.contentHeight; --Returns Screen Height
local cloudTable = {} – Set up clouds table
– [attributes of the “Main Menu”]
local title
local playButton
local creditsButton
local MainMenu
– [attributes of the “Credits”]
local creditsView
– [Heli]
local heli
– [Boss]
local boss
– [Score]
local score
– [Lives]
local lives
– Pause button
local pauseButton = display.newRect( 40, 40, 60, 30 )
– Load Sounds
local shot = audio.loadSound(‘shot.mp3’)
local explo = audio.loadSound(‘explo.mp3’)
local bossSound = audio.loadSound(‘boss.mp3’)
– Variables
local timerSource
local maintimer
local lives = display.newGroup()
local bullets = display.newGroup()
local enemies = display.newGroup()
local hardEnemies = display.newGroup()
local pwrUps = display.newGroup()
local hardEnemiesHealth = 4
local scoreN = 0
local bossHealth = 20
– Function’s declarations
local Main = {}
local addMainMenu = {}
local showCredits = {}
local removeCredits = {}
local removeMainMenu = {}
local addHeli = {}
local addScore = {}
local addLives = {}
local listeners = {}
local moveHeli = {}
local shoot = {}
local addEnemy = {}
local alert = {}
local update = {}
local collisionHandler = {}
local restart = {}
–This flag is used for the pop-up message that signals the level transition-----------
local flag
local weaponPwrUp = nil
– Main Function
function Main()
if (restart01 == true) then
physics.start()
end
addMainMenu()
end
–This function produces the “Main Menu” screen with the title and the credits button—
function addMainMenu()
title = display.newImage(‘title.png’)
playButton = display.newImage(‘playButton.png’)
playButton.x = display.contentCenterX
playButton.y = display.contentCenterY + 10
playButton:addEventListener(‘tap’, removeMainMenu)
creditsButton = display.newImage(‘creditsButton.png’)
creditsButton.x = display.contentCenterX
creditsButton.y = display.contentCenterY + 60
creditsButton:addEventListener(‘tap’, showCredits)
MainMenu = display.newGroup(title, playButton, creditsButton)
end
–This function removes the “Main Menu” screen and adds the player’s helicopter to the screen—
function removeMainMenu:tap(e)
transition.to(MainMenu, {time = 300, y = -display.contentHeight, onComplete = function() display.remove(MainMenu) MainMenu = null addHeli() end})
end
–This function is called to show the “Credits” page to the screen------------------------------
function showCredits:tap(e)
creditsButton.isVisible = false
creditsView = display.newImage(‘creditsView.png’)
creditsView:setReferencePoint(display.TopLeftReferencePoint)
transition.from(creditsView, {time = 300, x = display.contentWidth})
creditsView:addEventListener(‘tap’, removeCredits)
end
–This function is called to remove the “Credits” page from the screen with a tweening effect—
function removeCredits:tap(e)
creditsButton.isVisible = true
transition.to(creditsView, {time = 300, x = display.contentWidth, onComplete = function() display.remove(creditsView) creditsView = null end})
end
–This function initialises the cloud table---------------------------------------------------------
function initCloud()
local cloud1 = {}
cloud1.imgpath = “cloud.png”; --Set Image Path for the cloud
cloud1.movementSpeed = 10000; --Determines the movement speed of the cloud in milliseconds
table.insert(cloudTable, cloud1); --Insert Star into starTable
local cloud2 = {}
cloud2.imgpath = “cloud2.png”;
cloud2.movementSpeed = 12000;
table.insert(cloudTable, cloud2);
local cloud3 = {}
cloud3.imgpath = “cloud3.png”;
cloud3.movementSpeed = 14000;
table.insert(cloudTable, cloud3);
end
–This function returns a random star object from the starTable. Once the function gets the star, we set the—
–image path, the name of the star and how fast the star will move.--------------------------------------------
function getRandomCloud()
local temp = cloudTable[math.random(1, #cloudTable)] --gets a random cloud from the cloudTable and stores it in the local variable randomCloud
local randomCloud = display.newImage(temp.imgpath) --we set the image path of the cloud
physics.addBody(randomCloud, { isSensor = true } )
randomCloud.myName = “cloud” --we set the name of the cloud object to “cloud”
randomCloud.movementSpeed = temp.movementSpeed; --the movement speed will be set according to the speed of the random cloud that we pulled from the cloudTable
randomCloud.x = math.random(0,_W)–the starting point of the cloud is going to be a random X position on the bottom of the screen
randomCloud.y = -80 --the cloud will also start off the screen for a smoother transition into the visible area of the screen
randomCloud.rotation = math.random(0,360) --We also randomly rotate each cloud to add variance to the background
cloudMove = transition.to(randomCloud, {
time=randomCloud.movementSpeed,-- move the star towards the bottom of the screen.
y= 1000,
onComplete = function(self) self.parent:remove(self); self = nil; end --the object will then be removed from memory when it has reached its destination point
})
end
–This function starts the timers of the cloud addtition------------------------------------------------------
function startClouds()
cloudTimer1 = timer.performWithDelay(1700,getRandomCloud, 0)
cloudTimer2 = timer.performWithDelay(2300,getRandomCloud, 0)
cloudTimer3 = timer.performWithDelay(2700,getRandomCloud, 0)
end
–When the Start button is pressed the “Main Menu” screen is removed revealing the game view adding the helicopter movieclip—
function addHeli()
–Here we will start the cloud system
initCloud()
startClouds()
heli = sprite.newSprite(spriteSet2)
heli.x = display.contentWidth * 0.5
heli.y = display.contentHeight - 5
heli.name = ‘heli’
heli:play()
physics.addBody(heli)
addScore()
end
–This function creates the score and places it on the sage-------------------------------
function addScore()
score = display.newText('Score: ', 1, 0, native.systemFontBold, 14)
score.y = display.contentHeight + 15
score.text = score.text … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
–when the score is created we are going to call the function that is going to add the lives
addLives()
end
–This function creates the graphics for the lives left, also stores the number of lives in an array for defeat detection—
function addLives()
for i = 1, 3 do
live = display.newImage(‘live.png’)
live.x = (display.contentWidth - live.width * 0.7) - (5 * i+1) - live.width * i + 20
live.y = display.contentHeight +15
lives.insert(lives, live)
end
listeners(‘add’)
pauseButton:addEventListener(‘tap’, pause)
end
–This function adds the necesary listeners to the interactive objects, It also starts the timer that will add the enemies–
–A parameter is used to determine if the listeners should be added or removed----------------------------------------------
function listeners(action)
if(action == ‘add’) then
bg:addEventListener(‘touch’, moveHeli)
bg:addEventListener(‘tap’, shoot)
Runtime:addEventListener(‘enterFrame’, update)
–Syntax for the timer ( delay, listener [iterations] )
–Zero iterations because we want it to loop forever
timerSource = timer.performWithDelay(800, addEnemy, 0)
timerSource = timer.performWithDelay(2500, addPwrUps, 0)
else
bg:removeEventListener(‘touch’, moveHeli)
bg:removeEventListener(‘tap’, shoot)
Runtime:removeEventListener(‘enterFrame’, update)
timer.cancel(timerSource)
end
end
function pause()
if(paused == false) then
physics.pause()
listeners(‘remove’)
timer.cancel(timerSource)–stops the timer
timer.cancel(cloudTimer1)
timer.cancel(cloudTimer2)
timer.cancel(cloudTimer3)
paused = true
elseif(paused == true) then
physics.start()
listeners(‘add’)
paused = false
end
end
–Movement of the player’s helicopter----------------------------------------------
function moveHeli:touch(e)
if(e.phase == ‘began’) then
lastX = e.x - heli.x
elseif(e.phase == ‘moved’) then
heli.x = e.x - lastX
end
end
–Function that handles all the helicopters weapon system--------------------------
function shoot:tap(e)
if (weaponPwrUp == nil) then
local bullet = display.newImage(‘bullet.png’)
bullet.x = heli.x
bullet.y = heli.y - heli.height
bullet.name = ‘bullet’
physics.addBody(bullet)
audio.play(shot)
bullets.insert(bullets, bullet)
elseif (weaponPwrUp == 2) then
local bullet = display.newImage(‘bullet2.png’)
bullet.x = heli.x
bullet.y = heli.y - heli.height
bullet.name = ‘bullet2’
physics.addBody(bullet)
audio.play(shot)
bullets.insert(bullets, bullet)
elseif (weaponPwrUp == 3) then
local bullet = display.newImage(‘bullet3.png’)
bullet.x = heli.x
bullet.y = heli.y - heli.height
bullet.name = ‘bullet3’
physics.addBody(bullet)
audio.play(shot)
bullets.insert(bullets, bullet)
elseif (weaponPwrUp >=4) then
local bullet = sprite.newSprite(spriteSet1)
bullet:play()
bullet.x = heli.x
bullet.y = heli.y - heli.height
bullet.name = ‘railgun’
physics.addBody(bullet)
audio.play(shot)
bullets.insert(bullets, bullet)
end
end
–This function will add an enemy on the top of the screen, the enemy will be later moved by the update function—
–This function is executed by a timer every 800 milliseconds------------------------------------------------------
function addEnemy(e)
local enemy = movieclip.newAnim({‘enemyA.png’, ‘enemyA.png’,‘enemyA.png’,‘enemyA.png’,‘enemyA.png’,‘enemyA.png’,‘enemyB.png’,‘enemyB.png’,‘enemyB.png’,‘enemyB.png’,‘enemyB.png’,‘enemyB.png’})
enemy.x = math.floor(math.random() * (display.contentWidth - enemy.width))
enemy.y = -enemy.height
enemy.name = ‘enemy’
physics.addBody(enemy)
enemy.bodyType = ‘static’
enemies.insert(enemies, enemy)
enemy:play()
enemy:addEventListener(‘collision’, collisionHandler)
–Here is where we check the score for the ahrder enemies
if(scoreN > 300) then
–This if checks the flag (which is initialy null, and if it is null it shows a message to the screen
if( flag == nil)then
splash = display.newImage(“Splash lvl2.png”)
splash.x = display.contentWidth * 0.5
splash.y = display.contentHeight * 0.5
–The timer is placed to delay the message removal
timer.performWithDelay(4000, removePopper, 1)
flag = 1
end
local hardEnemy = movieclip.newAnim({‘hardEnemyA.png’, ‘hardEnemyA.png’,‘hardEnemyA.png’,‘hardEnemyA.png’,‘hardEnemyA.png’,‘hardEnemyA.png’,‘hardEnemyB.png’,‘hardEnemyB.png’,‘hardEnemyB.png’,‘hardEnemyB.png’,‘hardEnemyB.png’,‘hardEnemyB.png’})
hardEnemy.x = math.floor(math.random() * (display.contentWidth - hardEnemy.width))
hardEnemy.y = -hardEnemy.height
hardEnemy.name = ‘hardEnemy’
hardEnemy.life = 4
physics.addBody(hardEnemy)
hardEnemy.bodyType = ‘static’
hardEnemies.insert(hardEnemies, hardEnemy)
hardEnemy:play()
hardEnemy:addEventListener(‘collision’, collisionHandler)
if( hardEnemiesHealth == 0)then
hardEnemiesHealth = 4
end
end
end
–This function will add pwerups !!!-------------------------------------------------------------------------------
–This function is executed by a timer every 300 milliseconds------------------------------------------------------
function addPwrUps(e)
local pwrUp = movieclip.newAnim({‘pwrUp.png’, ‘pwrUp.png’,‘pwrUp.png’,‘pwrUp.png’,‘pwrUp2.png’,‘pwrUp2.png’,‘pwrUp2.png’,‘pwrUp2.png’})
pwrUp.x = math.floor(math.random() * (display.contentWidth - pwrUp.width))
pwrUp.y = -pwrUp.height
pwrUp.name = ‘pwrUp’
physics.addBody(pwrUp)
pwrUp.bodyType = ‘static’
pwrUps.insert(pwrUps, pwrUp)
pwrUp:play()
pwrUp:addEventListener(‘collision’, collisionHandler)
end
–This function removes the pop-up messages------------------------------------------------
function removePopper()
splash:removeSelf()
end
–This function is called when the player has won or lost-----------------------------------
function alert(e)
listeners(‘remove’)
local alertView
if(e == ‘win’) then
alertView = display.newImage(‘youWon.png’)
alertView.x = display.contentWidth * 0.5
alertView.y = display.contentHeight * 0.5
else
alertView = display.newImage(‘gameOver.png’)
alertView.x = display.contentWidth * 0.5
alertView.y = display.contentHeight * 0.5
end
alertView:addEventListener(‘tap’, restart)
end
–This function handles all the actions that occur on enterframe, such as movie clip movements–
function update(e)
–updateBackgrounds will call a function made specifically to handle the background movement
updateBackgrounds()
– Move Bullets
if(bullets.numChildren ~= 0) then
–This if handles the movement of bullet
for i = 1, bullets.numChildren do
bullets[i].y = bullets[i].y - 10
– Destroy Offstage Bullets
if(bullets[i].y < -bullets[i].height) then
bullets:remove(bullets[i])
display.remove(bullets[i])
bullets[i] = nil
end
end
end
– This handles the movement of the enemies
if(enemies.numChildren ~= 0) then
for i = 1, enemies.numChildren do
if(enemies[i] ~= nil) then
enemies[i].y = enemies[i].y + 3
– Destroy Offstage Enemies
if(enemies[i].y > display.contentHeight) then
enemies:remove(enemies[i])
display.remove(enemies[i])
end
end
end
end
– This handles the movement of the hard enemies
if(hardEnemies.numChildren ~= 0) then
for i = 1, hardEnemies.numChildren do
if(hardEnemies[i] ~= nil) then
hardEnemies[i].y = hardEnemies[i].y + 3
– Destroy Offstage Enemies
if(hardEnemies[i].y > display.contentHeight) then
hardEnemies:remove(hardEnemies[i])
display.remove(hardEnemies[i])
end
end
end
end
–This handles the movement of the powerUps
if(pwrUps.numChildren ~= 0) then
for i = 1, pwrUps.numChildren do
if(pwrUps[i] ~= nil) then
pwrUps[i].y = pwrUps[i].y + 3
– Destroy Offstage powerups
if(pwrUps[i].y > display.contentHeight) then
pwrUps:remove(pwrUps[i])
display.remove(pwrUps[i])
end
end
end
end
–This handles the boss
if(scoreN >= 1000 and boss == nil) then
audio.play(bossSound)
boss = movieclip.newAnim({‘bossA.png’,‘bossA.png’,‘bossA.png’,‘bossA.png’,‘bossA.png’, ‘bossA.png’,‘bossA.png’, ‘bossB.png’,‘bossB.png’,‘bossB.png’,‘bossB.png’,‘bossB.png’,‘bossB.png’,‘bossB.png’})
boss.x = display.contentWidth * 0.5
boss.name = ‘boss’
physics.addBody(boss)
boss.bodyType = ‘static’
transition.to(boss, {time = 1500, y = boss.height + (boss.height * 0.5)})
boss:play()
boss:addEventListener(‘collision’, collisionHandler)
end
end
function updateBackgrounds()
–far background movement
bg.y = bg.y + (1)
–near background movement
bgOnTop.y = bgOnTop.y + (1)
–if the sprite has moved off the screen move it back to the
–other side so it will move back on
if(bgOnTop.y > 480) then
bgOnTop.y = -2060
end
if(bg.y > -100) then
bg.y = -960
end
end
–This function handles all the collisions----------------------------
function collisionHandler(e)
–COLLISION FOR NORMAL ENEMIES
if(e.other.name == ‘bullet’ and e.target.name == ‘enemy’) then
audio.play(explo)
display.remove(e.other)
display.remove(e.target)
scoreN = scoreN + 50
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
elseif(e.other.name == ‘bullet2’ and e.target.name == ‘enemy’) then
audio.play(explo)
display.remove(e.other)
display.remove(e.target)
scoreN = scoreN + 50
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
elseif(e.other.name == ‘bullet3’ and e.target.name == ‘enemy’) then
audio.play(explo)
display.remove(e.other)
display.remove(e.target)
scoreN = scoreN + 50
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
elseif(e.other.name == ‘railgun’ and e.target.name == ‘enemy’) then
audio.play(explo)
–display.remove(e.other)
display.remove(e.target)
scoreN = scoreN + 50
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
–COLLISION FOR HARD ENEMIES
elseif(e.other.name == ‘bullet2’ and e.target.name == ‘hardEnemy’) then
audio.play(explo)
display.remove(e.other)
hardEnemiesHealth = hardEnemiesHealth - 4
scoreN = scoreN + 20
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
if(hardEnemiesHealth <= 0) then
display.remove(e.target)
end
elseif(e.other.name == ‘bullet3’ and e.target.name == ‘hardEnemy’) then
audio.play(explo)
display.remove(e.other)
hardEnemiesHealth = hardEnemiesHealth - 4
scoreN = scoreN + 20
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
if(hardEnemiesHealth <= 0) then
display.remove(e.target)
end
elseif(e.other.name == ‘bullet3’ and e.target.name == ‘hardEnemy’) then
audio.play(explo)
display.remove(e.other)
display.remove(e.target)
scoreN = scoreN + 20
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
elseif(e.other.name == ‘railgun’ and e.target.name == ‘hardEnemy’) then
audio.play(explo)
–display.remove(e.other)
display.remove(e.target)
scoreN = scoreN + 20
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
–COLLISION FOR BOSS
elseif(e.other.name == ‘bullet’ and e.target.name == ‘boss’) then
audio.play(explo)
display.remove(e.other)
bossHealth = bossHealth - 1
scoreN = scoreN + 50
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
if(bossHealth <= 0) then
display.remove(e.target)
alert(‘win’)
end
elseif(e.other.name == ‘bullet2’ and e.target.name == ‘boss’) then
audio.play(explo)
display.remove(e.other)
bossHealth = bossHealth - 4
scoreN = scoreN + 20
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
if(bossHealth <= 0) then
display.remove(e.target)
alert(‘win’)
end
elseif(e.other.name == ‘bullet3’ and e.target.name == ‘boss’) then
audio.play(explo)
display.remove(e.other)
bossHealth = bossHealth - 4
scoreN = scoreN + 20
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
if(bossHealth <= 0) then
display.remove(e.target)
alert(‘win’)
end
elseif(e.other.name == ‘railgun’ and e.target.name == ‘boss’) then
audio.play(explo)
display.remove(e.other)
bossHealth = bossHealth - 10
scoreN = scoreN + 20
score.text = 'Score: ’ … tostring(scoreN)
score:setReferencePoint(display.TopLeftReferencePoint)
score.x = 1
if(bossHealth <= 0) then
display.remove(e.target)
alert(‘win’)
end
–COLLISION FOR POWERUPS
elseif(e.other.name == ‘heli’ and e.target.name == ‘pwrUp’) then
audio.play(boss)
display.remove(e.target)
if(weaponPwrUp == nil) then
weaponPwrUp = 2
elseif(weaponPwrUp ==2) then
weaponPwrUp = 3
elseif(weaponPwrUp ==3) then
weaponPwrUp = 4
end
–COLLISION FOR THE HELICOPTER
elseif(e.other.name == ‘heli’) then
audio.play(explo)
display.remove(e.target)
– Remove Life
display.remove(lives[lives.numChildren])
– Check for Game Over
if(lives.numChildren < 1) then
alert(‘lose’)
end
end
end
–This function restarts the game--------------------------------
function restart()
listeners(‘remove’)
display.remove(bullets)
display.remove(enemies)
display.remove(hardEnemies)
display.remove(heli)
display.remove(alertView)
display.remove(boss)
display.remove(pwrUp)
display.remove(randomCloud)
display.remove(cloud)
bullets.numChildren = 0
enemies.numChildren = 0
hardEnemies.numChildren = 0
pwrUps.numChildren = 0
scoreN = 0
boss = nil
restart01 = true
physics.pause()
Main()
end
–NOW WE CALL THE MAIN FUNCTION
Main()[/lua] [import]uid: 109558 topic_id: 23703 reply_id: 323703[/import]
[import]uid: 109558 topic_id: 23703 reply_id: 95532[/import]