OK, I am now requiring physics on the top, also I have moved all physics functions(addbody, addjoints) to enterScene. Unfortunatly no succes. I am pasting bellow the whole code for createScene, nothing special in it.
function scene:createScene( event ) local group = self.view --COLLISION FILTERS buttonCollisionFilter1 = { categoryBits = 1, maskBits = 1 } buttonCollisionFilter2 = { categoryBits = 2, maskBits = 2 } leftLegCollisionFilter = { categoryBits = 4, maskBits = 36 } rightLegCollisionFilter = { categoryBits = 8, maskBits = 40 } climberCollisionFilter = { categoryBits = 16, maskBits = 48 } borderCollisionFilter = { categoryBits = 32, maskBits = 252 } leftArmCollisionFilter = { categoryBits = 64, maskBits = 96 } rightArmCollisionFilter = { categoryBits = 128, maskBits = 160 } limitFeetCollisionFilter = { categoryBits = 256, maskBits = 256 } hairCollisionFilter = { groupIndex = -2, categoryBits = 512, maskBits = 512 } routeId = storyboard.state.routeId myGameSettings = jsonCopy.loadTable("mygamesettings.json") local wrapText = require( "text" ) --SQLITE --get main route data for row in db:nrows("SELECT \* FROM main WHERE route\_id = " .. routeId) do routeW = row.width routeH = row.height routeName = row.route\_name description = row.description topHeight = row.topHeight difficulty = row.difficulty status = row.status count = row.count end myGameSettings.lastLevel = difficulty count = count + 1 local kl = ("UPDATE main SET count="..count .. " WHERE route\_id=" .. routeId) db:exec( kl ) if (routeW \> width) then startX = (width - routeW)/2 else startX = 0 end local backGround2 = display.newRect(menuTip, 0,0,width,height) backGround2:setFillColor(255,250,229) backGround = display.newRect( startX,(height-routeH),routeW,routeH) backGround.alpha = 0 backGround.isHitTestable = true local heightLimit = display.newLine( allElements, startX,topHeight, getWidth(), topHeight ) heightLimit:setColor( 200, 200, 200 ) heightLimit.width = 2 energyLimitText = display.newText (menuTip, "TRY TO REST!", width/2-120, height/2, native.systemFontBold, 35) energyLimitText:setTextColor( 200, 200, 200 ) energyLimitText.isVisible = false local heightLimitText = display.newText (allElements, "MAX HEIGHT", width/2, topHeight, native.systemFont, 20) heightLimitText:setTextColor( 200, 200, 200 ) if (topHeight == 0) or (status == 1) then heightLimit.isVisible = false heightLimitText.isVisible = false end --GRIFI local level = require("routes.route"..routeId) numberGrips = level.countT() for row in db:nrows("SELECT \* FROM route WHERE route\_id = " .. routeId) do local gripX = row.grip\_location\_x local gripY = row.grip\_location\_y local gripType = row.grip\_type end local function createGrips() local originX = width/2 local originY = height -75 --they begin from bellow for i=1,numberGrips do local r = (level[i][3]) local x = originX + level[i][1] local y = originY - level[i][2] if (r == 1) then grip[i] = display.newImage( allElements, "images/grif1.png", x, y ) elseif (r == 2) then grip[i] = display.newImage( allElements, "images/grif2.png", x, y ) elseif (r == 3) then grip[i] = display.newImage( allElements, "images/grif3.png", x, y ) end grip[i].status = "active" grip[i].size = gripSize[r].s end end createGrips() allElements:insert( backGround ) backGround:toBack() local function getGoal() local trueGoal if (routeH \> height) then trueGoal = 75 else trueGoal = 75-routeH+height end return trueGoal end local function getHeight() local trueHeight if (routeH \< height) then trueHeight = 0 else trueHeight = -routeH+height end return trueHeight end local goal = display.newRect(allElements, startX,getHeight(),getWidth(),getGoal()) goal:setFillColor( 255, 205, 5 ) local goalText = display.newText(allElements, "it ends here", 80,height-routeH,native.systemFontBold, 35) goalText:setTextColor(90) tipEnergyLeft = display.newImage( energy, "images/left\_handA.png", 40, 20) tipEnergyRight = display.newImage( energy, "images/right\_handA.png", width-120, 20) tipMenu = display.newImage( menuTip, "images/open\_menuA.png", width - 230, height-45) if myGameSettings.tipsOn then tipEnergyLeft.isVisible = true tipEnergyRight.isVisible = true tipMenu.isVisible = true else tipEnergyLeft.isVisible = false tipEnergyRight.isVisible = false tipMenu.isVisible = false end armTopL = display.newRect(allElements,w-59,h+29,38,8) setFill(armTopL, colorSkin) armTopR = display.newRect(allElements,w+23,h+29,38,8) setFill(armTopR, colorSkin) armBottomL = display.newRect(allElements,w-105,h+29,48,8) setFill(armBottomL, colorSkin) armBottomR = display.newRect(allElements,w+59,h+29,48,8) setFill(armBottomR, colorSkin) handL = display.newCircle(allElements,w-115,h+29,r) handR = display.newCircle(allElements,w+117,h+29,r) setFill(handL, colorSkin) setFill(handR, colorSkin) head = display.newCircle(allElements,w,h-2,20) head:setFillColor(50,50,50) torso1 = display.newRect(allElements,w-23,h+20,46,18) setFill(torso1, colorShirt) torso2 = display.newRect(allElements,w-20,h+36,40,18) setFill(torso2, colorShirt) torso3 = display.newRect(allElements,w-17,h+52,34,18) setFill(torso3, colorShirt) torso4 = display.newRect(allElements,w-14,h+68,28,12) setFill(torso4, colorShirt) torso5 = display.newRect(allElements,w-16,h+78,32,16) setFill(torso5, colorShirt) torso6 = display.newRect(allElements,w-18,h+92,36,16) setFill(torso6, colorPants) legTopL = display.newRect(allElements,w-18,h+106,16,58) setFill(legTopL, colorPants) legTopR = display.newRect(allElements,w+2,h+106,16,58) setFill(legTopR, colorPants) legBottomL = display.newRect(allElements,w-15,h+162,10,68) setFill(legBottomL, colorSkin) legBottomR = display.newRect(allElements,w+5,h+162,10,68) setFill(legBottomR, colorSkin) footL = display.newImage(allElements,"images/footL.png", w-34,h+228) footR = display.newImage(allElements,"images/footR.png",w+3,h+228) bag = display.newRect(allElements,w-10,h+92,20,30) bag:setFillColor(50,50,50) head:toFront() -- BUTTONS local buttonRadius = 35 button1 = display.newCircle(allElements,(footL.x-4),(footL.y),buttonRadius) button1.myName = "footL" button2 = display.newCircle(allElements,(footR.x+4),(footR.y),buttonRadius) button2.myName = "footR" button3 = display.newCircle(allElements,(handL.x),(handL.y),buttonRadius) button3.myName = "handL" button4 = display.newCircle(allElements,(handR.x),(handR.y),buttonRadius) button4.myName = "handR" end
To the error. widget.newTableVIew() is being used in scene2. There the player is selecting his level.