On Sun, Nov 14, 2010 at 10:25 AM, gontran <[email protected]> wrote:
> Thank you Mark for your answer, but could-you be more specific please?
> What do you mean by "pre-compute"?

Pre-compute = compute in advance.

If I understand correctly, you have 30 random numbers (six dice, five
state changes). You want the sum of the last six random numbers.

Right now, you appear to be generating those random numbers on the
fly. Rather than do that, compute them in advance. Then, you do not
have to worry about "wait that each animation has ended to calculate
the sum of each roll", because you already know the values.

Or, just pre-compute the last six random numbers (the ones you need to
sum), so on your last state change, you go to the pre-computed value
rather than generating another random number on the fly.

If your problem is more about displaying the sum at the right time,
more so than calculating it, just use a single AnimationListener on
one of your dice. If they are all animating simultaneously, they will
all end simultaneously, so just pick one and use that to time the
display of your sum.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 2.2 Programming Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to