Sunday, November 14, 2010

[android-developers] Re: Run instructions at the end of six animations played together

Ok, I get your point, but my problem is both displaying and
calculating the result at the right time because in my game, you roll
dices to get an asset of points, to attack another player... So
depending on the state of the game, the instructions run after each
rolls are not always the same. so after each roll, I have to display
the sum and other informations depending on the state of the game and
maybe changing the state (I use the state design pattern).

For me, the best solution would be to make a single animation to
animate the six dices, but correct me if I'm wrong, it's impossible to
make each dice rotate on itself with a single animation.

Anyway, thank you for your time.


On 14 nov, 16:36, Mark Murphy <mmur...@commonsware.com> wrote:
> On Sun, Nov 14, 2010 at 10:25 AM, gontran <geoffroydecorb...@gmail.com> 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/commonsguyhttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate