Game Development Reference
interface for its entire control scheme. With thoughtful and clever design of your games, you can
completely eliminate reliance on the keyboard, and your players will thank you for it.
So let's take a step-by-step look at how to control objects with the mouse.
Fixing an object to the mouse's position
Let's start by fixing an object to the mouse's t and u positions using the Ikqoa class. In the chapter's
source files is a folder called IkqoaLkejpan. Open it as a project and test it. You'll see that you can
control the up-and-coming star of this chapter, Button Fairy, just by moving the mouse around the
stage. Figure 10-6 illustrates what you will see.
Figure 10-6. Move the mouse to make Button Fairy fly around the stage.
When you move the mouse, the mouse pointer disappears, but the object remains fixed to the exact
position where it would be. This is a technique that you can use to create a custom mouse pointer for
any of your games.
The code also adds a dynamic drop-shadow filter to Button Fairy, which I'll discuss in a bit. All the
code is in the I]ej[IkqoaLkejpan class: