multiple display.newImage

hi,

i don’t understand why i clic, two object “cres” appears while I do not want one

thanks for you response

function appears ()     local xposition = math.random( 1, 250 )     local yposition = math.random( 1,250 )     local cres = display.newImage ("crate.png", xposition, yposition )     physics.addBody( cres, { density=1, friction=10, bounce=20 } ) end Runtime:addEventListener( "touch", appears )

Hello @espace3d,

The “touch” event has multiple phases including “began”, “moved”, and “ended”, and you need to handle them appropriately in your conditional logic. The following tutorial is a good starting point on this topic:

http://coronalabs.com/blog/2013/10/01/tutorial-taptouch-anatomy/

Best regards,

Brent

Hello @espace3d,

The “touch” event has multiple phases including “began”, “moved”, and “ended”, and you need to handle them appropriately in your conditional logic. The following tutorial is a good starting point on this topic:

http://coronalabs.com/blog/2013/10/01/tutorial-taptouch-anatomy/

Best regards,

Brent