© Lee Stemkoski 2018
Lee StemkoskiJava Game Development with LibGDXhttps://doi.org/10.1007/978-1-4842-3324-5_9

9. Drag-and-Drop Games

Lee Stemkoski1 
(1)
DEPT OF MATH & CS, ADELPHI UNIVERSITY DEPT OF MATH & CS, Garden City, New York, USA
 
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 ...

Get Java Game Development with LibGDX: From Beginner to Professional 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.