0
votes
1answer
150 views

How to accurately count 1 second within my logic update?

I have the following method: long time = system.nanoTime(); public void count(){ if (System.nanoTime() > (time+1000000000)){ //Output something or perform action here ...
2
votes
2answers
183 views

How can I create delays for sprite animations that work correctly when the application is killed and restored?

Please see my original question here: How should I use system time to compute delay times without stutters? In summary, I am attempting to to introduce a delay (say of 5 seconds or so) before a ...
0
votes
2answers
317 views

Using System Time to compute delay times that correctly deal with app pauses?

In my Android app I have the requirement to introduce small (for slowing down animation) and larger delays (for the purpose of delaying the appearance of a character for example). I've experimented ...
2
votes
3answers
247 views

Let a time counter working when an app is closed?

Can we let a time counter working even if an app is closed? I would like to add a timer so that we have to wait XX seconds/minutes before a building is created in a game. I don't want to use an ...
1
vote
1answer
97 views

Can't call method out of a timer. Why? [closed]

I have another problem i can't solve by myselve. My situation: I have four FrameLayouts in LinearLayouts. I color them, set Layout hight and width at wrap content and just change the minwidth to ...
4
votes
4answers
318 views

Playing a death anim on an enemy that I want to remove

I've been trying to find a tutorial on how to best make animations in Android. I already have some animations for my enemies and my character that are controlled by rectangles and changing ...
4
votes
1answer
321 views

Android Java: Way to effectively pause system time while debugging?

In my project, I call nanoTime and use that to get a deltaTime which I pass to my entities and animations. However, while debugging (for example, stepping through my code), the system time on my ...
3
votes
1answer
731 views

android game performance regarding timers

Im new to the game-dev world and I have a tendancy to over-simplify my code, and sometimes this costs me alot fo memory. Im using a custom TimerTask that looks like this: public class Task ...
5
votes
3answers
1k views

Thread runs faster on a faster processor… how to control Thread speed

I have a thread that uses TimeUnit.MILLISECONDS.sleep(5); Problem is when I load my app on a faster phone say with a snapdragon, it runs at lightning speed. Is there a way to control this speed so ...