Abstract
In this chapter, you will learn how to add drag-and-drop functionality to your games: the ability to click on an object and, while the mouse button is held down, have the selected object move along with the mouse until the button is released. Since this functionality is useful in many contexts, you will create an extension of the BaseActor class, called DragAndDropActor, containing the related code. To demonstrate the flexibility of this new class, you will create two new games that make use of this class. The first will be a jigsaw-puzzle game, shown in Figure 9-1, which consists of an image that has been broken into pieces and must be rearranged correctly on a grid. The second will be a solitaire card game called 52 Card Pickup, shown in Figure 9-2, where a standard deck of playing cards must be correctly arranged in a set of piles.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2018 Lee Stemkoski
About this chapter
Cite this chapter
Stemkoski, L. (2018). Drag-and-Drop Games. In: Java Game Development with LibGDX. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3324-5_9
Download citation
DOI: https://doi.org/10.1007/978-1-4842-3324-5_9
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3323-8
Online ISBN: 978-1-4842-3324-5
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)