Im new to Corona and Im creating my first game, Im creating a whack style game I have the following lua files
build.settings
config.lua
director.lua (version 1.4)
movieclip.lua
main.lua
mainmenu.lua
loadlevel1.lua
level1.lua
loadlevel2.lua
level2.lua
the app stars fine, the main menu is fine i press play then the loading level 1 page starts then the level
1 screen appears but my pictures don’t popup can someone help me please!
my code is the following
[lua]module(…, package.seeall)
–====================================================================–
– SCENE: LEVEL 1
–====================================================================–
new = function ()
local localGroup = display.newGroup()
local background = display.newImage( “gamebackground.png” )
– OBJECTS
local p1
local p2
local p3
local p4
local p5
local pollys
local lastPolly = {}
– Load Sound
local hit = audio.loadSound(‘Slap.wav’)
– Variables
local timerSource
local currentPollys = 0
local pollysHit = 0
local totalPollys = 5
– Functions
local showGameView = {}
local preparePollys = {}
local startTimer = {}
local showPolly = {}
local popOut = {}
local pollyHit = {}
local showGameView = function(event)
score = display.newText(‘0’ … ‘/’ … totalPollys, 400, 290, native.systemFontBold, 16)
score:setTextColor(700, 700, 100)
preparePollys()
end
–Prepare Pollys
local preparePollys = function (event)
p1 = display.newImage(‘Julia.png’, 200, 105)
p2 = display.newImage(‘abbott.png’, 360, 167)
p3 = display.newImage(‘Julia.png’, 360, 40)
p4 = display.newImage(‘abbott.png’, 50, 167)
p5 = display.newImage(‘Julia.png’, 200, 105)
pollys = display.newGroup(p1, p2, p3, p4, p5)
for i = 1, pollys.numChildren do
pollys[i]:addEventListener(‘tap’, pollyHit)
pollys[i].isVisible = false
end
startTimer()
end
local startTimer = function()
timerSource = timer.performWithDelay(1400, showPolly, 0)
end
local showPolly = function(event)
if(currentPollys == totalPollys) then
director:changeScene(“mainmenu”)
else
lastPolly.isVisible = false
local randomHole = math.floor(math.random() * 5) + 1
lastPolly = pollys[randomHole]
lastPolly:setReferencePoint(display.BottomCenterReferencePoint)
lastPolly.yScale = 0.1
lastPolly.isVisible = true
Runtime:addEventListener(‘enterFrame’, popOut)
currentPollys = currentPollys + 1
end
end
local popOut = function(event)
lastPolly.yScale = lastPolly.yScale + 0.2
if(lastPolly.yScale >= 1) then
Runtime:removeEventListener(‘enterFrame’, popOut)
end
end
local pollyHit = function(event)
audio.play(hit)
pollysHit = pollysHit + 1
score.text = pollysHit … ‘/’ … totalPollys
lastPolly.isVisible = false
end
return localGroup
end
[import]uid: 166525 topic_id: 31124 reply_id: 331124[/import]