Stack traceback when i run my app in the simulator

Because it tells you where to put things…

Rob

I went over it more than 10 times and i still don’t know where to put everything .

Have you looked at this?

https://coronalabs.com/blog/2015/04/14/tutorial-the-basic-game-template/

Rob

Add everything in one by one … Make sure everything is working.

–SonicX278

Yes I did i took my times with it more than 10 times and i still don’t know where to put anything. That’s what i’m doing and i still don’t know where to put not one function .

Hmm can you post the code you want redone?

–SonicX278

-- requires local physics = require "physics" physics.start() local composer = require( "composer" ) local scene = composer.newScene() -- background function scene:createScene(event) local screenGroup = self.view local background = display.newImageRect("bg.png",display.contentWidth,display.contentHeight) background.x = display.contentCenterX background.y = display.contentCenterY local city1 = display.newImage("city1.png") city1.x = 240 city1.y = 210 city1.speed = 2 local city2 = display.newImage("city1.png") city2.x = 240 city2.y = 270 city2.speed = 2 local city3 = display.newImage("city2.png") city3.x = 240 city3.y = 270 city3.speed = 3 local jet = display.newImage("redJet.png") jet.x = 100 jet.y = 100 physics.addBody(jet, "dynamic", {density=.1, bounce=0.1, friction=.2, radius=12}) local city4 = display.newImage("city2.png") city4.x = 240 city4.y = 270 city4.speed = 3 end function scrollCity( self, event ) if self.x \< -200 then self.x = 200 else self.x = self.x - self.speed end end -- jet function activateJets( self, event ) self:applyForce(0, -3.0, self.x, self.y) end function touchScreen( event ) if event.phase == "began" then jet.enterFrame = activateJets Runtime: addEventListener("enterFrame", jet) end if event.phase == "ended" then Runtime: removeEventListener("enterFrame", jet) end end function scene:enterScene(event) city1.enterFrame = scrollCity Runtime:addEventListener("enterFrame", city1) city2.enterFrame = scrollCity Runtime:addEventListener("enterFrame", city2) city3.enterFrame = scrollCity Runtime:addEventListener("enterFrame", city3) city4.enterFrame = scrollCity Runtime:addEventListener("enterFrame", city4) Runtime:addEventListener("touch", touchScreen) end function scene:exitScene(event) end function scene:destroyScene(event) end scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene) return scene

The template that comes with Composer should show you.  Read the game.lua template. It’s commented heavily saying where to put things. But to repeat the tutorials:

-- top if scene file -- local composer = require( "composer" ) local scene = composer.newScene() -- put your other require's here and create the scene local json = require( "json" ) -- put any forward declared variables here: local score = 0 local level = 1 -- put any functions that need to be used throughout the app. -- put them in the reverse order they are accessed. In other words if -- function A calls function B, function B needs to be declared before function A or it has to be forward declared -- -- You put your functions here -- local function incrementLevel() &nbsp;&nbsp;&nbsp;&nbsp; level = level + 1 end -- -- now declare the scene's events -- function scene:create( event ) ... end function scene:show( event ) ... end function scene:hide( event ) ... end function scene:destroy( event ) ... end -- define the event handlers scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- -- return the required object -- return scene
function scene:exitScene(event) end function scene:destroyScene(event) end scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene)

This is all “Storyboard” code. It is not Composer code.

Composer code uses these functions:

function scene:create( event ) ... end function scene:show( event ) ... end function scene:hide( event ) ... end function scene:destroy( event ) ... end -- define the event handlers scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- -- return the required object -- return scene

You can either use Composer or you can use Storyboard, but you can’t mix them.

Rob

So I can still use storyboard for my project ?

Yes. Back like the 3rd post in this thread from RoamingGamer, he said exactly what you need to do to keep using Storyboard, but to save you time:

  1. Go to:   http://github.com/coronalabs/framework-storyboard-legacy

  2. Download it.

  3. Copy the storyboard.lua to your project in the same folder as your main.lua

That’s it. You can keep using storyboard.

Rob

But when i run it i just get a black screen

What errors? Please copy/paste them here for us to see?  What line number is it say it’s happening on?  Post the code around that line too.

Rob

Sorry I didn’t mean to put errors i just get a black screen when i run it in the simulator 

You’re getting errors. There should be a console window with text messages. There should be more information there.

Rob

This is what it tells me

What does the first line say?

What were my instructions a couple of posts ago? You have to go to our github site, download the old storyboard code and put storyboard.lua in the same folder with your main.lua.

This message says you have not done this yet.

Rob

I’m still getting the same error 

Put the entire code right ?

I think it’s not working because you are just putting code in a blender and then throwing it at the simulator and trying to make it work… You need to start from scratch.

–SonicX278