Game Development Reference
In-Depth Information
Figure 17-19
.
Use GIMP to create a nine-point collision polygon for your Enemy Actor
Before we go into the InvinciBagel.java class to declare and instantiate an Enemy
object named iBeagle, let's create the
Projectile.java
class, so that our Enemy object
has Projectile objects to shoot at the InvinciBagel character!
Creating Cream Cheese Bullets: Coding a Pro-
jectile.java Class
Now that we have added positive (Treasure) elements to our game, let's add some neg-
ative (Enemy and Projectile) elements to the game, so that we remain “balanced” in our
development work process! Create a
Projectile.java
class and constructor method that
sets
isFixed
to
false
(since projectiles fly) and
isBonus
and
hasValu
to true, so the ob-
ject properties are set. The Java code for this Projectile.java class can be seen in
Figure
package invincibagel;
import javafx.scene.image.Image;
public class
Projectile
extends Actor {
public
Projectile
(String SVGdata, double xLocation,