Hey all,
I have a wee problem with my code but can not understand why, i will start by posting the code and the error in the terminal
local function onLocalCollision( self, event )
if ( event.phase == "began" ) then
audio.play( soundStrawberry )
strawberryPosition:removeSelf()
strawberryPosition = nil
--This creates the word and then sends it upwards and fades is out
screenMessageStrawberry = display.newText( "Fraise", 160, 240, "Helvetica-Bold", 70)
screenMessageStrawberry:setTextColor( 0, 0, 255, 255 )
screenMessageStrawberry.alpha = 1.0
screenMessageStrawberry.xScale = 0.5; screenMessageStrawberry.yScale = 0.5
screenMessageStrawberry.xOrigin = 170
screenMessageStrawberry.yOrigin = 400
transition.to(screenMessageStrawberry, {time=3000, alpha=0, y=-50, transition = easing.linear})
gameGroup:insert( screenMessageStrawbery )
end
end
strawberryPosition.collision = onLocalCollision
strawberryPosition:addEventListener( "collision", strawberryPosition )
error message:
Runtime error
…sers/chrisalmond/Documents/Kidstart Corona/fruit.lua:157: attempt to perform arithmetic on field ‘x’ (a nil value)
stack traceback:
[C]: ?
…sers/chrisalmond/Documents/Kidstart Corona/fruit.lua:157: in function <…sers corona>
?: in function <?:214>
So here is my explanation , i only have one group in my code and that is “localGroup”, NOT “gameGroup”, BUT when I replace “gameGroup” with “localGroup” or do not put it into a group it does not work, so I have to keep “gameGroup” just to be able to dispaly the scene.
If anybody has any Ideas on how I can get this to work please please post your hints and tips, as this is my last hurdle before release
Many thanks
Chris
[import]uid: 10697 topic_id: 8455 reply_id: 308455[/import] </…sers>