–
– main.lua
local bg = display.newImage(“bg.jpg”,display.contentWidth, display.contentHeight)
bg.x = display.contentWidth / 2
bg.y = display.contentHeight / 2
local logo = display.newImage(“logo.png”)
logo.x = display.contentCenterX
logo.y = display.contentHeight + 100;
logo:scale(2,2)
logo.alpha = 0
local scoure = 0
local text
local nbrmax = 10
local yournbr = 0
local bnadm
local Hfarii = {}
local psa2
local randomm
function go()
yournbr = yournbr+1
randomm = math.random( 0, 8 )
bnadm = display.newImage(“c.png”)
bnadm.x = Hfarii[randomm].x
bnadm.y = Hfarii[randomm].y
bnadm.xScale = 0.2
bnadm.yScale = 0.2
function bnadm:touch(e)
scoure = scoure + 5
end
bnadm:addEventListener( “touch”, bnadm )
function bnadmkill(e)
display.remove( bnadm )
if yournbr <= nbrmax then
go()
end
if yournbr > nbrmax then
text = display.newText(“Your Scoure :”…scoure, 0,0, “Tahoma”, 24 )
text.x = display.contentCenterX
text.y = display.contentHeight-20
text:setTextColor( 0, 0, 0 )
end
end
transition.to(bnadm,{time=500,xScale = 1,yScale = 1,onComplete=bnadmkill})
end
local function StartApp()
local function StartGame()
display.remove( logo )
display.remove( text )
local y = 60
for i=0,2 do
Hfarii[i] = display.newImage(“hfra.png”)
Hfarii[i].x = 20
Hfarii[i].y = y
Hfarii[i]:scale(.4,.4)
y = y + 100
end
y = 60
for i=3,5 do
Hfarii[i] = display.newImage(“hfra.png”)
Hfarii[i].x = 150
Hfarii[i].y = y
Hfarii[i]:scale(.4,.4)
y = y + 100
end
y = 60
for i=5,7 do
Hfarii[i] = display.newImage(“hfra.png”)
Hfarii[i].x = 280
Hfarii[i].y = y
Hfarii[i]:scale(.4,.4)
y = y + 100
end
go()
end
local function showPlay()
text = display.newText("- Play -", 0,0, “Tahoma”, 24 )
text.alpha = 0
text:setTextColor( 0, 0, 0 )
text.x = display.contentCenterX
text.y = display.contentHeight-20
transition.to(text,{time=1000,alpha=1})
text:addEventListener( “tap”, StartGame )
end
transition.to(logo,{time=1000,alpha=1,xScale = 1,yScale = 1,y=display.contentCenterY,onComplete=showPlay})
end
StartApp()
– Your code here