I tried to create a counter which counts the lap(s) completed by a car but whenever the car touches the finish line the counter counts continuously..how can can i call the method of another actor once at a time so that the counter works properly...
private boolean touchingLine;
// in act
if (touchingLine != isTouching(Line.class)) // if change in state
{
touchingLine = !touchingLine; // track new state
if (touchingLine) laps++; // if new state is true, add to counter
}