This is the full .lua
[code]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– this will only happen once when the scene is first required.
print (“in load splashscreen file”)
function scene:createScene( event )
local group = self.view
–BACKGROUND IMAGES
local background = display.newImage(“gnomiessplashbg.png”)
group:insert(background) – must be in the scene’s view (“group”) to be managed.
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2
–media.playSound( “gnomiesmusic.mp3”, true )
local backgroundbg2 = display.newImage(“gnomiessplashbg2.png”)
group:insert(backgroundbg2)
backgroundbg2.x = display.contentWidth / 2
backgroundbg2.y = display.contentHeight / 2
–BACKGROUND IMAGES END
–BUTTONS
local worlds = display.newImage(“gnomiesPlaybutton.png” )
group:insert(worlds)
worlds.x = display.contentWidth / 1.9
worlds.y = display.contentHeight / 2.1
local options = display.newImage(“gnomiesOptionsbutton.png” )
group:insert(options)
options.x = display.contentWidth / 1.9
options.y = display.contentHeight / 1.5
local about = display.newImage(“gnomiesAboutbutton.png” )
group:insert(about)
about.x = display.contentWidth / 1.9
about.y = display.contentHeight / 1.16
–END BUTTONS
local function playtouched (event)
if (“ended” == event.phase) then
storyboard.gotoScene( “worlds”, “fade” )
end
end
worlds:addEventListener (“touch”, playtouched)
local function optionstouched (event)
if (“ended” == event.phase) then
storyboard.gotoScene(“options”, “fade” )
end
end
options:addEventListener (“touch”, optionstouched)
local function abouttouched (event)
if (“ended” == event.phase) then
storyboard.gotoScene( “about”, “fade” )
end
end
about:addEventListener (“touch”, abouttouched)
end
–STARS
display.setStatusBar( display.HiddenStatusBar )
_W = display.contentWidth; --Returns Screen Width
_H = display.contentHeight; --Returns Screen Height
local starTable = {} – Set up star table
function initStar()
local star1 = {}
star1.imgpath = “star1.png”; --Set Image Path for Star
star1.movementSpeed = 10000; --Determines the movement speed of star
table.insert(starTable, star1); --Insert Star into starTable
local star2 = {}
star2.imgpath = “star2.png”;
star2.movementSpeed = 12000;
table.insert(starTable, star2);
local star3 = {}
star3.imgpath = “star3.png”;
star3.movementSpeed = 14000;
table.insert(starTable, star3);
end --END initStar()
function getRandomStar()
local temp = starTable[math.random(1, #starTable)] – Get a random star from starTable
local randomStar = display.newImage(temp.imgpath) – Set image path for object
group:insert(star1)
group:insert(star2)
group:insert(star3)
group:insert(randomStar)
randomStar.myName = “star” – Set the name of the object to star
randomStar.movementSpeed = temp.movementSpeed; – Set how fast the object will move
randomStar.x = math.random(0,_W) – Set starting point of star at a random X position
randomStar.y = -50 – Start the star off screen
randomStar.rotation = math.random(0,360) – Rotate the object
starMove = transition.to(randomStar, {
time=randomStar.movementSpeed,
y=_H,
onComplete = function(self) self.parent:remove(self); self = nil; end
}) – Move the star
end–END getRandomStar()
function startGame()
starTimer1 = timer.performWithDelay(1700,getRandomStar, 0)
starTimer2 = timer.performWithDelay(2300,getRandomStar, 0)
starTimer3 = timer.performWithDelay(2700,getRandomStar, 0)
end–END startGame()
initStar()
startGame()
–STARS
function scene:enterScene( event )
local group = self.view
end
function scene:exitScene( event )
local group = self.view
end
function scene:destroyScene( event )
local group = self.view
end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )
return scene
[/code] [import]uid: 72845 topic_id: 34466 reply_id: 137284[/import]