I don’t understand where is the error
main.lua
local storyboard = require("storyboard") storyboard.gotoScene("starter")
starter.lua
local storyboard = require ("storyboard") local scene = storyboard.newScene() function scene:createScene(event) local gruppo = self.view local button = display.newImage("button.png") button.x = 120 button.y = 235 gruppo:insert(button) function click(event) if event.phase == "ended" then storyboard.gotoScene("level1") end return true end button:addEventListener("touch" , click) end scene:addEventListener("createScene" , scene) return scene
untill now nothing is wrong
level1.lua
local storyboard = require("storyboard") local scene = storyboard.newScene() function scene:createScene(event) local gruppo = self.view local fisica = require "physics" fisica.start() fisica.setGravity(0,0) local one = display.newImage("sfondo.png") sfondo.x =-4 sfondo.y =270 fisica.addBody(one,"dynamic") gruppo:insert(sfondo) local two = display.newImage("muretto.png") muretto.x = 100 muretto.y = 270 fisica.addBody(two,"dynamic") gruppo:insert(muretto) function move1() transition.to(one, {time = 1000 , x = 200 }) end function move2() transition.to(two, {time = 1000 , x = - 200 }) end move1() move2() function win(event) storyboard.gotoScene("win") end Runtime:addEventListener("collision" , win) end scene:addEventListener("createScene", scene) return scene
When the collision happens an error is diplayed with this:
" attempt to concatenate global sceneName < a nil value >"
this is the win.lua I don’t know if it can bu usefull to understand the error
win.lua
local storyboard = require("storyboard") local scene = storyboard.newScene() function scene:createScene(event) local gruppo = self.view local sfondo = display.newImage("sfondo.png") sfondo.x =-4 sfondo.y =270 gruppo:insert(sfondo) end scene:addEventListener("createScene" , scene) return scene
What can be the problem???
Please don’t say me to read the blog because I alreay read the blog and i didn’t find the solution