O'Reilly logo

Android NDK Game Development Cookbook by Viktor Latypov, Sergey Kosarevsky

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the animated 3D image selector

The main UI element of our puzzle game is the animated 3D image selector. In this recipe, we show you how to render the animated carousel-like selector and interact with the user.

Getting ready

Before proceeding with this recipe, you may need to go back to Chapter 7, Cross-platform UI and Input System, and read how the Canvas class works. A bit of mathematics will be required to understand better how the code in this recipe works.

How to do it...

The idea behind the rendering is quite simple. We let the individual quads move in a way that their corners slide along four guiding curves. The following figure shows the same quad in a series of positions:

The four curves show the paths of the quad's corners.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required