This site requires JavaScript, please enable it in your browser!
Greenfoot back
dirtyninja1
dirtyninja1 wrote ...

2017/5/5

GifImage as a background/world

1
2
danpost danpost

2017/5/7

#
@Yehuda, the GifImage class does not keep track of where you pause the animation and (re)starting the animation will always start at the first image regardless of where it was stopped at.
Yehuda Yehuda

2017/5/8

#
danpost wrote...
@Yehuda, the GifImage class does not keep track of where you pause the animation and (re)starting the animation will always start at the first image regardless of where it was stopped at.
That's not true by me. All the pause() and resume() methods do is changes a variable (running variable 'pause') and changes the amount of running time ('time'). Since it uses System.currentTimeMillis() it doesn't know whether the execution was running or not, so if you pause the execution, then resume it after waiting a few seconds the animation won't start from the beginning or from where it left off, it goes by the elapsed time from initialization. So adding in the methods that I suggested is the way to make the animation continue from where it left off after resuming the paused execution.
danpost danpost

2017/5/8

#
danpost wrote...
(re)starting the animation will always start at the first image regardless of where it was stopped at.
After taking a closer look at the 'getCurrentImage' method, I realized that this was inaccurate. The process used to determine the current image is far different from what I imagined it would be. I am not particular impressed by the way it is coded; but, it gets the job done.
Yehuda Yehuda

2017/5/8

#
danpost wrote...
After taking a closer look at the 'getCurrentImage' method, I realized that this was inaccurate. The process used to determine the current image is far different from what I imagined it would be. I am not particular impressed by the way it is coded; but, it gets the job done.
I was wondering if you've looked at the GifImage class code, so I guess this is over.
You need to login to post a reply.
1
2