Flipping… Coins!

Progressing through ‘Booty!’ we wanted to be able to establish which player goes first. Staying true to our motivation to keep it as close to the ‘live action’ game itself, we wanted to include an actual coin flip which is ultimately settled via a random number generator…

The fun part comes with the actual need to animate the coin flipping.

I had looked into multiple ways of doing it, personally I wanted to keep the animation set to an XML file stored within the res/anim folder, for organisational and simplicity’s sake.

So, the challenge was to both have the coin image flipping (Combination of scaling and translating the image) as well as switching the image to make it appear more realistic.

Unfortunately, the difficulties came when essentially trying to simultaneously fire two animations at the same time.

There were various different actual coin ‘flipping’ animations, however I favoured one which scaled larger ‘out of the screen’ to give the coin a sense of depth. So I used this one off stack overflow admittedly, the fellow who was using it wasn’t using it to its full potential (i’d argue). So I combined it with a lightweight message handling animation system, which effectively emulates what I wanted to achieve! Vids/Screens to follow soon!