CHAPTER 7

image

Mouse and Touch Events

You’ve learned how to add interactivity to sprites, using the keyboard, but most of your games and applications will use a mouse or touch interface. In this chapter, you’ll learn how to

  • Use a universal pointer object to interact with sprites
  • Work with mouse and touch events
  • Create a drag-and-drop interface
  • Create clickable, pressable buttons

And, as a bonus, at the end of this chapter, you’ll put all these skills together to make a complete game.

But first, let’s find out the basics you need to know to start using mouse and touch interactivity with Pixi.

Setting Up Tink

Pixi has a limited set of built-in tools ...

Get Learn Pixi.js: Create Great Interactive Graphics for Games and the Web now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.