I'm trying to make the player loose one heart then cool down for a second after being hit. For an example
if(a.overlaps(b)) {
p.health--;
}
would lower the health while being touched. In my old game I used a thread algorithm to wait a second, but that took a while. Besides doing some kind of complicated timer method, what can I do to keep to the player hit one at a time?