application:setKeepAwake(true) application:setOrientation(Application.PORTRAIT) --require('mobdebug').start() require "box2d" --local font_loading = TTFont.new("fonts/futur1.ttf", 40) local function draw_loading() loading = Sprite.new() local logo = Bitmap.new(Texture.new("images/jdbc_games.png", true)) logo:setScale(0.67) logo:setY(150) loading:addChild(logo) stage:addChild(loading) end local function preloader() stage:removeEventListener(Event.ENTER_FRAME, preloader) -- Load all your assets here MenuScene.setup() GameScene.setup() ChooseScene.setup() Paddle.setup() Ball.setup() Hud.setup() Caption.setup() SoundManager.setup() ScoreScene.setup() WorldCupScene.setup() Advertise.setup() -- Game starting scenes = {"menu", "choose", "game", "score", "worldcup"} sceneManager = SceneManager.new({ ["menu"] = MenuScene, ["choose"] = ChooseScene, ["game"] = GameScene, ["score"] = ScoreScene, ["worldcup"] = WorldCupScene }) stage:addChild(sceneManager) local currentScene = scenes[1] local timer = Timer.new(1000, 1) timer:addEventListener(Event.TIMER, function() -- Remove loading scene stage:removeChild(loading) loading = nil sceneManager:changeScene(currentScene) end) timer:start() --sceneManager:changeScene(currentScene) end draw_loading() stage:addEventListener(Event.ENTER_FRAME, preloader)