I have a game (for example, a super-jumper, this game is a jumping game) that our character has life. after a collision with enemies, his life decreases. and I want to calculate collisions after 1 second. I mean for this 1 second, if my character contacts the enemies, nothing happens, and he continues on his way. for this I define a boolean in the GameScreen class, the name is "collision" and another in the Wolrd class, the name is "collBirds". after one contact with an enemy collision, and collBirds change to true. but I want it to change to false after a one second collision. I use a few things like System.currentTimeMillis () and "for loop" and nothing happens. I am not so good at java.
this is my condition:
if(World.collBirds == true && collition == false){ life -= 1; lifeString = "Life : " + life; World.collBirds = false; collition = true; for (??? "need to stay here for 1 sec" ???) { collition = false; } }
Hosein
source share