Abstract
This chapter begins by reviewing the code for the game from the previous chapter. Your main focus will be streamlining your code from the previous chapter by refactoring common elements into new classes that can be reused as needed. This will also make it easier to introduce more-advanced features, such as new methods for processing user input. Then you will see how your new classes can be used as a basis for additional game projects. Finally, you will improve your custom extensions of the Actor class by adding improved collision detection and response, managing multiple animations, and implementing physics-based movement.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
It is called anonymous because it is not assigned a name, and thus can’t be accessed again for later use.
- 2.
Technically, you’re really interested in only whether Balloon objects pass beyond the boundary of the screen, and mainStage also stores the BaseActor that stores the background image. Fortunately, the background can’t move off-screen and so you can use the Stage’s internal list for your purposes. In future programs, you’ll be forced to be more precise, and keep track of and process different types of game entities using different lists.
- 3.
Although LibGDX contains an Ellipse class, there are no classes or methods in LibGDX that perform collision detection with ellipse shapes; however, Polygon objects do have such functionality available.
- 4.
The interval extends from 0 to 6.28 because mathematical functions typically use radian measure for angles rather than degree measure. 6.28 radians roughly corresponds to 360 degrees, which represents a full rotation around the origin, which we need when calculating the values of points all the way around the ellipse.
Author information
Authors and Affiliations
Electronic Supplementary Material
Below is the link to the electronic supplementary material.
Rights and permissions
Copyright information
© 2015 Lee Stemkoski
About this chapter
Cite this chapter
Stemkoski, L. (2015). Extending the Framework. In: Beginning Java Game Development with LibGDX. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1500-5_3
Download citation
DOI: https://doi.org/10.1007/978-1-4842-1500-5_3
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-1501-2
Online ISBN: 978-1-4842-1500-5
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)