Hi guys!
When I run the onCollision function, it seems that it collides with the ‘ground’ multiple times, even though its not moving. How can I make it so once the object hits the ground, it only collides with it ‘once’?
I would like to give a ‘score’ every time it hits the ground, but because it hits the ground multiple times, my score seems to keep going up.
here is part of the code:
function playerCollision( self, event ) if ( event.phase == "began" ) then --if hit bottom column, u get points if event.target.type == "player" and event.other.type == "bottomColumn" then print ("hit column") onPlatform = true else --if hit anything else, gameOver --composer.gotoScene( "restart" ) print ("hit ground") end end end
If someone can help me out, It’d be much appreciated!