SOMEONE PLEASE HELP ME

this is my main.lua  code 

local composer = require(“composer”)

composer.gotoScene(“scene1”)

this is my scene1.lua code 

local composer = require(“composer”)

local scene = composer.newScene()

local startup = display.newText(“CLICK ANYWHERE TO START”, 0, 0, native.systemFontBold,20)

local warning = display.newText("DONT FORGET THE NARWHALS A RAGING DIABETIC ", 0, 0, native.systemFontBold,20)

startup.x = display.viewableContentWidth /2

startup.y = display.viewableContentHeight  / 2 

warning.x = (display.viewableContentWidth /2) 

warning.y = (display.viewableContentHeight  / 2) + 50 

 local function start() 

local level = 55 

local score = 0 

local background = display.newImage(“black.png”, 0 , 0 )

background:scale(7,5)

local startup = display.newText(“CLICK ANYWHERE TO START”, 0, 0, native.systemFontBold,20)

local warning = display.newText(" Keep the Narwhals Blood Sugar between 50 and 60 ", 0, 0, native.systemFontBold,20)

startup.x = display.viewableContentWidth /2

startup.y = display.viewableContentHeight  / 2 

warning.x = (display.viewableContentWidth /2) 

warning.y = (display.viewableContentHeight  / 2) + 50 

end 

local function game(event)

local background = display.newImage(“water.jpg”,0, 0)

background:scale(2,2)

local good 

local physics = require(“physics”)

physics.start() 

–set a score label 

local level = 55

local score = 0

local scorelabel =  display.newText(level, 0, 0, native.systemFontBold,120)

scorelabel.x = display.viewableContentWidth /2

scorelabel.y = display.viewableContentHeight  / 2

scorelabel:setTextColor(0,0,0,10)

local timelabel =  display.newText(score, 0, 0, native.systemFontBold,70)

timelabel.x = 0

timelabel.y = 50

timelabel:setTextColor(0,0,0,10)

–create a player 

–creates and returns a new player 

local function createPlayer(x, y)

–player is a black square 

local p =  display.newImage(“narwhal.png”,x,y)

p:scale(2,2)

local playerCollisionFilter = {categoryBits = 2, maskBits = 5}

local playerBodyElement = {filter=playerCollisionFilter}

p.isbullet =true 

p.objectType = “player”

physics.addBody(p, “static”, playerBodyElement)

p.isSleepingAllowed = false 

return p

end 

local player = createPlayer(350,270)

local function stayOnScreen(object)

if object.x >= 500 then 

object.x =  500

end

if object.x <= 1  then

object.x = 2

end

 if object.y > 250   then

object.y = 250

end

 if object.y <= 270 then 

object.y = 270

end

end

local function onTouch(event)

if “began” == event.phase then 

player.isFocus = true

player.x0 = event.x - player.x

player.y0 = event.y - player.y

elseif player.isFocus then

if “moved” == event.phase then

player.x = event.x - player.x0

player.y = event.y - player.y0

stayOnScreen(player)

elseif “ended” == phase or “cancelled” == phase then

player.isFocus = false 

end 

end

return true

end 

background:addEventListener( “touch”, onTouch)

local function which()

local numba = math.random(1,3)

if numba == 1 then 

image = “orangegood.png”

end

if numba == 2 then 

image = “watermelon.png”

end

if numba == 3 then 

image = “apple.png”

end 

return image 

end 

–creates food 

local function spawn(objectType, x, y )

local object

local sizeXY = math.random(20,100)

local collisionFilter = {categoryBits = 4, maskBits = 2}

local body = {filter = collisionFilter, isSensor = true}

object = display.newImage(which(), x, y )

object.objectType = objectType

physics.addBody(object, body)

object.isFixedRoatation = true 

return object

end

local function shark (objectType, x, y )

local object

local sizeXY = math.random(20,100)

local collisionFilter = {categoryBits = 4, maskBits = 2}

local body = {filter = collisionFilter, isSensor = true}

object = display.newImage(“shark.png”, x, y )

object:scale(2,2)

object.objectType = objectType

physics.addBody(object, body)

object.isFixedRoatation = true 

return object

end

local function onTimer( event )

local green = spawn(“food”, math.random(1,500),-100)

end

timer.performWithDelay( 100, onTimer, 0 )

local function onTimer( event )

if level > 50 and level < 60 then

score = score + 1

timelabel.text = score

end 

end

timer.performWithDelay( 400, onTimer, 0 )

local function onTimer( event )

local blue = shark(“enemy”, math.random(1,500),-100 )

end

timer.performWithDelay( 100, onTimer, 0 )

–notification of collisionFilter

local function onCollision(event)

local type1 = event.object1.objectType

local type2 = event.object2.objectType

print("collision between " … type1 … " and " … type2)

if type1 == “food” or type2 == “food” then

level = level + .5

else

level = level - .5

end 

if level > 60  then 

for id, value in pairs(timer._runlist) do

     timer.cancel(value)

end

local widget = require(“widget”)

local function Restart(event)

    if “began” == event.phase then

       

     level = 55 

 score = 0

   composer.gotoScene(“scene2”)

    elseif “moved” == event.phase then

        --code here when  move

    elseif “ended” == event.phase or “cancelled” == event.phase then

        --code here when touch end

    end

end

– Create the widget

local button1 = widget.newButton{

    left = 100,

    top = 200,

    id = “button1”,

    label = “RESTART”,

    onEvent = Restart

}

end

if level < 50  then  

for id, value in pairs(timer._runlist) do

     timer.cancel(value)

end

local widget = require(“widget”)

local function Restart(event)

    if “began” == event.phase then

     

     level = 55 

 score = 0

  composer.gotoScene(“scene2”)

    elseif “moved” == event.phase then

        --code here when  move

    elseif “ended” == event.phase or “cancelled” == event.phase then

        --code here when touch end

    end

end

– Create the widget

local button1 = widget.newButton{

    left = 100,

    top = 200,

    id = “button1”,

    label = “RESTART”,

    onEvent = Restart

}

end

scorelabel.text = level 

end

Runtime:addEventListener(“collision”, onCollision)

end

Runtime:addEventListener(“touch”, game)

return scene

this is my scene2.lua code 

local composer = require(“composer”)

local scene = composer.newScene() 

local function goback(event)

if event.phaseif “began” == event.phase then

       

     

 composer.gotoScene(“scene1”)

    elseif “moved” == event.phase then

             

 composer.gotoScene(“scene1”)

    elseif “ended” == event.phase or “cancelled” == event.phase then

             

 composer.gotoScene(“scene1”)

end 

end 

local background = display.newImage(“black.png”, 0 , 0 )

background:scale(7,5)

local startup = display.newText(“CLICK ANYWHERE TO START”, 0, 0, native.systemFontBold,20)

local warning = display.newText("DONT FORGET THE NARWHALS A RAGING DIABETIC ", 0, 0, native.systemFontBold,20)

startup.x = display.viewableContentWidth /2

startup.y = display.viewableContentHeight  / 2 

warning.x = (display.viewableContentWidth /2) 

warning.y = (display.viewableContentHeight  / 2) + 50 

Runtime:addEventListener(“touch”, goback)

return scene  

please help me figure out how to get back to scene1 specifics would be appreciated please do not suggest the tutorials because i have watched and still can not figure out I really really need help specific to my project and would appreciate any input 

thank you 

Hi Matt.  Please don’t be too upset at what I’m writing, but you’re likely not going to get a lot of help for this for several reasons

1.  Your code is unformatted.  It’s hard to read and follow.  Please use the <> button in the bar above, and paste your code in there to get proper formatting.

  1. There is not a clear issue of your problem.  Your title is “SOMEONE PLEASE HELP ME”, not “I’m having a problem with X”.  In addition, it’s all upper case which in Internet culture is shouting.    What text you have provided gives a hint at the problem.  But you’ve not given any specifics about what you’ve tried, what error’s your seeing, etc.

3.  Anyone who posts is going to suggest you read more tutorials.  The information you need to solve this problem is there.  Maybe if you’re only using video tutorials, some text and code based tutorials might get you started.  In fact I recommend the following:

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

http://docs.coronalabs.com/api/library/composer/index.html

http://docs.coronalabs.com/guide/system/composer/index.html

https://coronalabs.com/blog/2014/01/21/introducing-the-composer-api-plus-tutorial/

https://coronalabs.com/blog/2014/06/03/tutorial-understanding-the-composer-api/

In a quick glace, you’re scenes are not scenes.  They are missing required structure like create, show and hide events.  This all is covered in depth in the above tutorials.  Please spend some time trying to understand what is required in a scene file and change your code to conform with the requirements.   The first tutorial was just published and gives you a very clear example of how to structure your scene files.

Rob

Here’s another suggestion from a total newbie: think smaller. It looks to me like you’ve jumped in with some moderately sophisticated concepts. I’d suggest, for what it’s worth, that you try to implement the things you’re trying to implement but on standalone little test files first, and then use the Simulator to test them until you’re sure you know how to implement those concepts. Then try to roll them out in your main app on a larger scale.

Just my two cents. Best of luck. 

Hi Matt.  Please don’t be too upset at what I’m writing, but you’re likely not going to get a lot of help for this for several reasons

1.  Your code is unformatted.  It’s hard to read and follow.  Please use the <> button in the bar above, and paste your code in there to get proper formatting.

  1. There is not a clear issue of your problem.  Your title is “SOMEONE PLEASE HELP ME”, not “I’m having a problem with X”.  In addition, it’s all upper case which in Internet culture is shouting.    What text you have provided gives a hint at the problem.  But you’ve not given any specifics about what you’ve tried, what error’s your seeing, etc.

3.  Anyone who posts is going to suggest you read more tutorials.  The information you need to solve this problem is there.  Maybe if you’re only using video tutorials, some text and code based tutorials might get you started.  In fact I recommend the following:

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

http://docs.coronalabs.com/api/library/composer/index.html

http://docs.coronalabs.com/guide/system/composer/index.html

https://coronalabs.com/blog/2014/01/21/introducing-the-composer-api-plus-tutorial/

https://coronalabs.com/blog/2014/06/03/tutorial-understanding-the-composer-api/

In a quick glace, you’re scenes are not scenes.  They are missing required structure like create, show and hide events.  This all is covered in depth in the above tutorials.  Please spend some time trying to understand what is required in a scene file and change your code to conform with the requirements.   The first tutorial was just published and gives you a very clear example of how to structure your scene files.

Rob

Here’s another suggestion from a total newbie: think smaller. It looks to me like you’ve jumped in with some moderately sophisticated concepts. I’d suggest, for what it’s worth, that you try to implement the things you’re trying to implement but on standalone little test files first, and then use the Simulator to test them until you’re sure you know how to implement those concepts. Then try to roll them out in your main app on a larger scale.

Just my two cents. Best of luck.