Hi Rob, thank you for your fast reply. I must added wrongly or removed something that I wasn’t supposed to, I can’t run it anymore, now it says:
Error loading module ‘setupFile’ from file ‘/Users/Snakewar/Desktop/Flying Aliens/code/setupFile.lua’:
/Users/Snakewar/Desktop/Flying Aliens/code/setupFile.lua:19: unexpected symbol near ‘‚’
File: error loading module ‘setupFile’ from file ‘setupFile.lua’
stack traceback:
C: in function ‘require’
?: in function ‘require’
main.lua:10: in main chunk
The code of setupFile.lua is:
--CHECK adsLib.lua TO ADD YOUR ADS KEYS --CHECK build.settings TO FINALIZE SHARE/ADS --CHECK gameScene.lua TO CHANGE OTHER PARAMETERS RELATED TO THE GAME local ragdogLib = require "ragdogLib"; local adsLib = require "adsLib"; local networksLib = require "networksLib"; local totalWidth = \_G.totalWidth; local totalHeight = \_G.totalHeight; local leftSide = \_G.leftSide; local rightSide = \_G.rightSide; local topSide = \_G.topSide; local bottomSide = \_G.bottomSide; local centerX = display.contentCenterX; local centerY = display.contentCenterY; local layersWidth = math.max(512, totalWidth); \_G.activateInAppPurchase = true; \_G.iApItems = { [“250Coins"] = {"com.denwatech.100coins"}, [“500Coins"] = {"com.denwatech.500coins"}, [“1000Coins"] = {"com.denwatech.1000coins"}, ["removeAds"] = {"com.denwatech.removeAds”}, }; \_G.activeRemoveAdsButton = true; \_G.activateCharacterSelect = true; \_G.showInGameCurrency = true; \_G.totalCoins = ragdogLib.getSaveValue("coins") or 0; \_G.twitterConsumerKey = "zTOwTDWojSfMXSXK7RmpX3zmj"; \_G.twitterSecretKey = "i0Twy92iQbFg5d0aEHh1NcaPAWG3GiMMPpPmKjOaJ5HOgnwN7O"; \_G.facebookAPPID = "116596392089785"; \_G.socialShareMessage = "I just made totalPoints in Flying Aliens"; \_G.imageForSocialPluginShare = "Icon.png"; \_G.useSocialPlugin = true; --here we setup the data for the characters. You need to put the name for that character, the path for the spritesheet of that character, --width/height of the spritesheet, number of frames in the sheet, width/height of a single frame within the spritesheet, the path for the image that will appear in the selection screen, width/height of that image, if it's locked or not by default --and cost in in-game coins in case it's locked. --you can add as many characters as you want \_G.characterData = { [1] = { "Bird 1", "IMG/birdSheet.png", 150, 38, 3, 50, 38, "IMG/birdPortrait1.png", 43, 31, false }, [2] = { "Bird 2", "IMG/birdSheet2.png", 150, 38, 3, 50, 38, "IMG/birdPortrait2.png", 43, 31, true, 300 }, }; \_G.characterAnimation = { ["Bird 1"] = { {name = "flap", frames = {1, 2, 3, 2}, time = 400, loopCount = 0}, {name = "death", frames = {2}, time = 200, loopCount = 0}, }, ["Bird 2"] = { {name = "flap", frames = {1, 2, 3, 2}, time = 400, loopCount = 0}, {name = "death", frames = {2}, time = 200, loopCount = 0}, }, }; for i = 1, #\_G.characterData do if \_G.characterData[i][11] then if ragdogLib.getSaveValue(\_G.characterData[i][1]) then \_G.characterData[i][11] = false; if not \_G.chosenCharacter then \_G.chosenCharacter = \_G.characterData[i]; end end else if not \_G.chosenCharacter then \_G.chosenCharacter = \_G.characterData[i]; end end end --And here we can set our backgrounds. They're made up of 5 layers plus the pipes. --You can add infinite numbers of backgrounds. --Where present, the 4th number after path, width and height indicates the offset Y to position that layer relative to the ground. \_G.backgroundsData = { [1] = { sky = {"IMG/bg.png", totalWidth, totalHeight}, ground = {"IMG/ground.png", layersWidth, 124}, city = {"IMG/skyline.png", layersWidth, 64, -30}, bushes = {"IMG/grass.png", layersWidth, 52, -5}, clouds = {"IMG/clouds.png", layersWidth, 112, -40}, pipes = {"IMG/tube.png", 60, 512} }, [2] = { sky = {"IMG/bg2.png", totalWidth, totalHeight}, ground = {"IMG/ground2.png", layersWidth, 124}, city = {"IMG/skyline2.png", layersWidth, 64, -30}, bushes = {"IMG/grass2.png", layersWidth, 52, -5}, clouds = {"IMG/clouds2.png", layersWidth, 112, -40}, pipes = {"IMG/tube.png", 60, 512} } }; local activeNetworksProviders = { ["Android"] = {"google", "YOUR LEADERBOARD ID"}, --replace "google" with "none" if you don't use any leaderboard! ["iPhone OS"] = {"gamecenter", "YOUR LEADERBOARD ID"} --replace "gamecenter" with "none" if you don't use any leaderboard! }; local function systemEvents( event ) if ( event.type == "applicationSuspend" ) then elseif ( event.type == "applicationResume" ) then elseif ( event.type == "applicationExit" ) then elseif ( event.type == "applicationStart" ) then networksLib.init(activeNetworksProviders); end return true end Runtime:addEventListener( "system", systemEvents ) --CHECK TUTORIAL ON HOW TO SET ADS UP HERE http://ragdogstudios.com/2014/08/23/adslib-v2-how-to-implement-it-and-maximize-your-revenues/ local adsSettings = { ["iPhone"] = { ["game\_over"] = { mediationType = "order", adType = "interstitial", frequency = 1, keepOrderDuringSession = true, providers = { [1] = { providerName = "chartboost", providerFallback = 2, mustBeCached = true, }, [2] = { providerName = "revmob", providerFallback = 1, mustBeCached = false } } }, ["during\_game"] = { mediationType = "order", adType = "banner", frequency = 1, adPosition = "top", keepOrderDuringSession = true, providers = { [1] = { providerName = "revmob", providerFallback = nil } } } }, ["Android"] = { ["game\_over"] = { mediationType = "order", adType = "interstitial", frequency = 1, keepOrderDuringSession = true, providers = { [1] = { providerName = "chartboost", providerFallback = 2, mustBeCached = true, }, [2] = { providerName = "revmob", providerFallback = 1, mustBeCached = false } } }, ["during\_game"] = { mediationType = "order", adType = "banner", frequency = 1, adPosition = "top", keepOrderDuringSession = true, providers = { [1] = { providerName = "revmob", providerFallback = nil } } } } }; local activeAdsProviders = { ["Android"] = {"revmob", "chartboost"}, -- possible values are "tapfortap", "admob", "playhaven", "revmob", "chartboost", "iads" ["iPhone"] = {"revmob", "chartboost"} --it should include all the ads providers you've put in the adsSettings table }; adsLib.init(activeAdsProviders, adsSettings);
And for main.lua is
display.setStatusBar(display.HiddenStatusBar); \_G.totalWidth = display.contentWidth-(display.screenOriginX\*2); \_G.totalHeight = display.contentHeight-(display.screenOriginY\*2); \_G.leftSide = display.screenOriginX; \_G.rightSide = display.contentWidth-display.screenOriginX; \_G.topSide = display.screenOriginY; \_G.bottomSide = display.contentHeight-display.screenOriginY; local setupFile = require "setupFile"; local facebook = require( "plugin.facebook.v4" ) local fpsLib = require "fpsLib"; local composer = require "composer"; composer.recycleOnSceneChange = true; fpsLib.init(); \_G.buttonSFX = audio.loadSound("SFX/wooshSFX.mp3"); local totalWidth = \_G.totalWidth; --I localize this because it'll be used intesively here; local originX = display.screenOriginX --we're gonna need this as well; --we put the creation of the level parallax effect here, since we're going to use that in most scenes \_G.createParallaxBackground = function(group, bgData) --let's hold a single width for all the layers, to help support multi devices and improve performances local layersWidth = math.max(512, totalWidth); --layer for the ground local activeGround, inactiveGround, groundLayer1, groundLayer2; groundLayer1 = display.newImageRect(group, bgData.ground[1], bgData.ground[2], bgData.ground[3]); groundLayer1.x, groundLayer1.y = display.contentCenterX, display.contentHeight; groundLayer2 = display.newImageRect(group, bgData.ground[1], bgData.ground[2], bgData.ground[3]); groundLayer2.x, groundLayer2.y = groundLayer1.x+layersWidth, groundLayer1.y; activeGround = groundLayer1; inactiveGround = groundLayer2; --layer with the clouds local activeClouds, inactiveClouds, cloudsLayer1, cloudsLayer2; cloudsLayer1 = display.newImageRect(group, bgData.clouds[1], bgData.clouds[2], bgData.clouds[3]); cloudsLayer1.x, cloudsLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.clouds[4]; cloudsLayer2 = display.newImageRect(group, bgData.clouds[1], bgData.clouds[2], bgData.clouds[3]); cloudsLayer2.x, cloudsLayer2.y = cloudsLayer1.x+layersWidth, cloudsLayer1.y; activeClouds = cloudsLayer1; inactiveClouds = cloudsLayer2; --layer for the city local activeCity, inactiveCity, cityLayer1, cityLayer2; cityLayer1 = display.newImageRect(group, bgData.city[1], bgData.city[2], bgData.city[3]); cityLayer1.x, cityLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.city[4]; cityLayer2 = display.newImageRect(group, bgData.city[1], bgData.city[2], bgData.city[3]); cityLayer2.x, cityLayer2.y = cityLayer1.x+layersWidth, cityLayer1.y; activeCity = cityLayer1; inactiveCity = cityLayer2; --layer for the bushes local activeBush, inactiveBush, bushLayer1, bushLayer1; bushLayer1 = display.newImageRect(group, bgData.bushes[1], bgData.bushes[2], bgData.bushes[3]); bushLayer1.x, bushLayer1.y = groundLayer1.x, groundLayer1.contentBounds.yMin+bgData.bushes[4]; bushLayer2 = display.newImageRect(group, bgData.bushes[1], bgData.bushes[2], bgData.bushes[3]); bushLayer2.x, bushLayer2.y = bushLayer1.x+layersWidth, bushLayer1.y; activeBush = bushLayer1; inactiveBush = bushLayer2; --we create our game layer here, so that pipes and birds will be below the ground but over the background local gameLayer = display.newGroup(); group:insert(gameLayer); group:insert(groundLayer1); group:insert(groundLayer2); function groundLayer1:enterFrame() if not group.paused then local gameSpeed = group.gameSpeed; local groundPosition = activeGround.x; groundPosition = groundPosition-gameSpeed; activeGround.x = groundPosition; inactiveGround.x = groundPosition+layersWidth; if groundPosition+layersWidth\*.5 \<= originX then activeGround, inactiveGround = inactiveGround, activeGround; end local cloudPosition = activeClouds.x; cloudPosition = cloudPosition-gameSpeed\*.1; activeClouds.x = cloudPosition; inactiveClouds.x = cloudPosition+layersWidth; if cloudPosition+layersWidth\*.5 \<= originX then activeClouds, inactiveClouds = inactiveClouds, activeClouds; end local cityPosition = activeCity.x; cityPosition = cityPosition-gameSpeed\*.2; activeCity.x = cityPosition; inactiveCity.x = cityPosition+layersWidth; if cityPosition+layersWidth\*.5 \<= originX then activeCity, inactiveCity = inactiveCity, activeCity; end local bushPosition = activeBush.x; bushPosition = bushPosition-gameSpeed\*.4; activeBush.x = bushPosition; inactiveBush.x = bushPosition+layersWidth; if bushPosition+layersWidth\*.5 \<= originX then activeBush, inactiveBush = inactiveBush, activeBush; end end end Runtime:addEventListener("enterFrame", groundLayer1); return gameLayer; --we return a handle to our new game layer to use in our scene modules end composer.gotoScene("menuScene", "fade"); local screenShotNumber = 1; function keyIsPressed(event) if event.keyName == "a" and event.phase == "down" then display.save(storyboard.getScene(storyboard.getCurrentSceneName()).view, "screen"..screenShotNumber..".png", system.DocumentsDirectory, true); screenShotNumber = screenShotNumber+1; end end --Runtime:addEventListener("key", keyIsPressed);
Thank you!!!