Hi guys,
I’ve got one more question. In my game, the user will get a point every time the ball hits the ground. The ball is controlled by the player. The ball has some bounce to it.
Now the problem is that for some reason the ball always detects to many collisions. So for example, if it hits the ground once, the score goes up by 3. I tried removing the eventlistener every time when the ball hits the ground and re-adding the listener after 100 milliseconds. But this is giving some real strange behaviour (Scores going up with what seems random values when a collision occurs).
This is the code:
function functions.startCollisionDetector() ball:addEventListener("collision", functions.collisionDetector) end function functions.collisionDetector(event) if event.other == floor then score = score + 1 scoreTxt.text = "score: " .. score ball:removeEventListener("collision", functions.startCollisionDetector) timers.restartCollisionDetector = timer.performWithDelay(100, functions.startCollisionDetector, 1) end end
Could someone help me? 
Kind regards
