I am using AndEngine to add sprites to a scene.
The sprites are all added at a Timed interval that I can control through a class i created for it.
For Example to set the time(as second)
Timer timer = new Timer();
timer.setInterval(Float second);
I created this method so that the timer could change as i needed it to during the user interaction with the game.
So as the sprites are added to the scene they move on the y axis at random places.
I have two intervals that they take to control the max duration and minimum duration they take to move across the screen.
For example…
Private int MaxDurarion = 4;// 4 is equivalent to 4 seconds for this
Private int MinDuration = 2 //Same for minimum duration
I have a IUpdateHandler that is designed to be updated every second.
So in this method i update the score and other things accordingly.
Now the problem is i check to see if the user has reached a certain score, if they have then i would like to decrease the max duration and the minimum duration.
For Example..
if(userScore == MAX){
MaxDuration = MaxDuration - (int).2;
TimerSecond = TimerSecond - .1f;
}
Now i have tried it this way, but i have found that the Maxduration returns back to the original integer after each update.
I hope ive explained this well enough what i am trying to do.
Is there a better way to do this?
Thanks guys.
You are casting
.2to anintwhich I believe is resulting in 0, so you aren’t changing theMaxDurationat all.