Skip to main content
  • 1538 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    It is called anonymous because it is not assigned a name, and thus can’t be accessed again for later use.

  2. 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. 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. 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

Authors

Electronic Supplementary Material

Below is the link to the electronic supplementary material.

978-1-4842-1501-2_Ch03_code.zip (zip 17441 kb)

Rights and permissions

Reprints 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

Publish with us

Policies and ethics