Book Image

Creative Greenfoot: RAW

By : Michael Haungs
Book Image

Creative Greenfoot: RAW

By: Michael Haungs

Overview of this book

Table of Contents (17 chapters)
Creative Greenfoot
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 4. Projectiles

 

"Flying is learning how to throw yourself at the ground and miss."

 
 --Douglas Adams

Actors in creative Greenfoot applications, such as games and animations, often have movement that can best be described as being launched. For example, a soccer ball, bullet, laser, light ray, baseball, and firework are examples of this type of object. One common method of implementing this type of movement is to create a set of classes that model real-world physical properties (mass, velocity, acceleration, friction, and so on) and have game or simulation actors inherit from these classes. Some refer to this as creating a physics engine for your game or simulation. However, this course of action is complex and often overkill. As you learned in Chapter 2, Animation, there are often simple heuristics we can use to approximate realistic motion. This is the approach we will take here.

In this chapter, you will learn about the basics of projectiles, how to make an object bounce, and a little...