if (touchHealth == 1) {
curTime = System.currentTimeMillis();
if (curTime >= lastAdded + 5000) {
if (touchEnemy == 0) {
((HealthBar)getWorld().getObjects(HealthBar.class).get(0)).healthNum++;
removeTouching(Enemy.class);
touchHealth = 0;
}
}
}
everything in this code is working fine except for the curTime. For example; if the enemy touches the player for 5 seconds, it should remove the enemy. However, it doesn't do that. If I take the cutTime part out it works, but I won't have a timer. Please help