As said in other threads I am trying to switch scene on contact of crate and ground . I have tried to correct my code and I get this error :
Windows simulator build date: Nov 18 2014 @ 18:35:32
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
create initialized? table: 02D68F20
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
create initialized? table: 09F1E8C0
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
Syntax error
c:\users\true\documents\corona projects\test bench\main.lua:35: ‘)’ expected (to
close ‘(’ at line 32) near ‘self’
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
Syntax error
c:\users\true\documents\corona projects\test bench\main.lua:35: ‘)’ expected (to
close ‘(’ at line 32) near ‘self’
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
Syntax error
c:\users\true\documents\corona projects\test bench\main.lua:32: unexpected symbo
l near ‘)’
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
Syntax error
c:\users\true\documents\corona projects\test bench\main.lua:32: ‘}’ expected nea
r ‘)’
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
Syntax error
c:\users\true\documents\corona projects\test bench\main.lua:32: unexpected symbo
l near ‘)’
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
Syntax error
c:\users\true\documents\corona projects\test bench\main.lua:32: unexpected symbo
l near ‘)’
Code main.lua:
----------------------------------------------------------------------------------------- -- -- main.lua -- ----------------------------------------------------------------------------------------- local composer = require( "composer" ) local physics = require( "physics" ) physics.start() physics.setGravity(0, 15) -- display ground image local ground = display.newImageRect( "ground.png", 500, 100 ) ground.x = 145; ground.y = 480 ground.myName = "ground" physics.addBody( ground, "static" , { friction=0.5, bounce=0.1 } ) local crate = display.newImageRect( "crate.png", 90, 90 ) print("create initialized? ", crate ) crate.x = 60; crate.y = 20 crate.rotation = 0 crate.myName = "crate" physics.addBody( crate, "dynamic" , { friction=0.5, bounce=0.3 } ) local function onCollision( self, event ) local other = event.other if( event.phase == "began" and self.isCrate and other.isGround ) then timer.performWithDelay( 30, function() composer.gotoScene { "restart.lua", "fade", 500 }) end self:removeEventListener( "collision" ) end return true end crate.collision = onCollision crate:addEventListener( "collision" )
What is the problem here?What corrections do I need?
Thank you.
