Hello i have tried everything but fail i need to do following things
-
cutscene ( my banner of company )
-
copyright and update or advertised scene
-
then go to main.lua
Please give me tutorial thanks
Hello i have tried everything but fail i need to do following things
cutscene ( my banner of company )
copyright and update or advertised scene
then go to main.lua
Please give me tutorial thanks
Hi @jeremy.carter29.
main.lua is the entry point to your app. It will get executed. You can choose to have main.lua go to a “Spash” screen, what you’re referring to as a “cutscene” if you want. If you want to have more of a movie like credits, you could have your splash screen go to a copyright scene and so on. You can also use what’s known as a Launcher Image (Default.png) that shows while your app is loading as your splash screen that occurs before your main.lua executes, but you have no control on how long it shows.
I tend to go from a splash screen to a menu screen and then on that menu screen give the user a button to your credits screen.
Now that said, Apple prefers you use Default.png to closely mimic the first screen that your users will see and not have splash screens and such and would prefer to get to something the users can do as soon as possible.
Rob
You could use Composer/Storyboard for this sort of thing. If you want something simpler, something like this - there are functions to create your various title screens and one to run the game - the sequencing and transitions are handled by the sceneSequencer() function.
function createCutScene(group) group:insert(display.newText("MyCompany Inc.",display.contentWidth/2,display.contentHeight/2,native.systemFont,32)) end function createCopyrightScene(group) group:insert(display.newText("(C) Me Forever",display.contentWidth/2,display.contentHeight/2,native.systemFont,32)) end function runGame() display.newText("Score: 00000",display.contentWidth/2,64,native.systemFont,32):setFillColor(1,1,0) display.newCircle(display.contentWidth/2,display.contentHeight/2,100):setFillColor(0,1,1) end local currentScene = 0 -- current scene, 1 = cut, 2 = copyright etc. local currentGroup = nil -- current displayed group. local fadeTime = 800 -- fade in/out time. function sceneSequencer() if currentGroup ~= nil then -- if there is a current group, fade out and remove it. transition.to(currentGroup,{ time = fadeTime, alpha = 0, onComplete = function(obj) obj:remove() end}) end currentScene = currentScene + 1 -- go to next scene. local nextSceneTime = 4000 -- delay to next cut scene. if currentScene == 1 then -- cut Scene. currentGroup = display.newGroup() createCutScene(currentGroup) end if currentScene == 2 then -- copyright scene. currentGroup = display.newGroup() createCopyrightScene(currentGroup) end if currentScene == 3 then -- run game if scene 3 timer.performWithDelay(fadeTime,runGame) -- allow time for the last scene to fade else currentGroup.alpha = 0 timer.performWithDelay(fadeTime, -- fade the new one in after the old one fades out. function() transition.to(currentGroup, { time = fadeTime, alpha = 1 }) end) timer.performWithDelay( nextSceneTime, sceneSequencer) -- run this function again after allowing time for the display. end end sceneSequencer()
Sorry actually i m asking … following things
I need the code of following scene changing
Well, it’s the same thing, really, you just put whatever you want on the scenes and wait for as long as you want (OTOMH you cannot check the actual status of advert display ?)
If you put your current main.lua as main2.lua you can just do require(“main2”) and this will load and run main2.lua (providing you haven’t already required it, lua caches required libraries but it doesn’t matter if you only require it once).
Alternatively you could create a simple “start” function wrapping your ‘main’ code and return that as a function from require and call it.
ok thanks for reply one last question will u please answer sir http://forums.coronalabs.com/topic/48847-ads-question-noob/
Hi @jeremy.carter29.
main.lua is the entry point to your app. It will get executed. You can choose to have main.lua go to a “Spash” screen, what you’re referring to as a “cutscene” if you want. If you want to have more of a movie like credits, you could have your splash screen go to a copyright scene and so on. You can also use what’s known as a Launcher Image (Default.png) that shows while your app is loading as your splash screen that occurs before your main.lua executes, but you have no control on how long it shows.
I tend to go from a splash screen to a menu screen and then on that menu screen give the user a button to your credits screen.
Now that said, Apple prefers you use Default.png to closely mimic the first screen that your users will see and not have splash screens and such and would prefer to get to something the users can do as soon as possible.
Rob
You could use Composer/Storyboard for this sort of thing. If you want something simpler, something like this - there are functions to create your various title screens and one to run the game - the sequencing and transitions are handled by the sceneSequencer() function.
function createCutScene(group) group:insert(display.newText("MyCompany Inc.",display.contentWidth/2,display.contentHeight/2,native.systemFont,32)) end function createCopyrightScene(group) group:insert(display.newText("(C) Me Forever",display.contentWidth/2,display.contentHeight/2,native.systemFont,32)) end function runGame() display.newText("Score: 00000",display.contentWidth/2,64,native.systemFont,32):setFillColor(1,1,0) display.newCircle(display.contentWidth/2,display.contentHeight/2,100):setFillColor(0,1,1) end local currentScene = 0 -- current scene, 1 = cut, 2 = copyright etc. local currentGroup = nil -- current displayed group. local fadeTime = 800 -- fade in/out time. function sceneSequencer() if currentGroup ~= nil then -- if there is a current group, fade out and remove it. transition.to(currentGroup,{ time = fadeTime, alpha = 0, onComplete = function(obj) obj:remove() end}) end currentScene = currentScene + 1 -- go to next scene. local nextSceneTime = 4000 -- delay to next cut scene. if currentScene == 1 then -- cut Scene. currentGroup = display.newGroup() createCutScene(currentGroup) end if currentScene == 2 then -- copyright scene. currentGroup = display.newGroup() createCopyrightScene(currentGroup) end if currentScene == 3 then -- run game if scene 3 timer.performWithDelay(fadeTime,runGame) -- allow time for the last scene to fade else currentGroup.alpha = 0 timer.performWithDelay(fadeTime, -- fade the new one in after the old one fades out. function() transition.to(currentGroup, { time = fadeTime, alpha = 1 }) end) timer.performWithDelay( nextSceneTime, sceneSequencer) -- run this function again after allowing time for the display. end end sceneSequencer()
Sorry actually i m asking … following things
I need the code of following scene changing
Well, it’s the same thing, really, you just put whatever you want on the scenes and wait for as long as you want (OTOMH you cannot check the actual status of advert display ?)
If you put your current main.lua as main2.lua you can just do require(“main2”) and this will load and run main2.lua (providing you haven’t already required it, lua caches required libraries but it doesn’t matter if you only require it once).
Alternatively you could create a simple “start” function wrapping your ‘main’ code and return that as a function from require and call it.
ok thanks for reply one last question will u please answer sir http://forums.coronalabs.com/topic/48847-ads-question-noob/