Game Development Reference
In-Depth Information
You can then refine your collision polygon structure data point by data point, by
clicking and dragging these points with your mouse, as seen in
Figure 17-23
.
If you
compare the collision polygon in
Figure 17-22
with the one in
Figure 17-23
,
you can
see I that have refined several of the data points to better conform to the outline of the
sprite.
Enemy
iBeagle
; // Object Declarations
go at top of InvinciBagel.java class
Projectile
iBullet
,
iCheese
;
private Image iB0, iB1, iB2, iB3, iB4, iB5, iB6, iB7,
iB8, iP0, iP1, iT0, iT1,
iE0
,
iC0
,
iC1
;
iE0
= new Image("
/enemy.png
", 70, 116, true, false,
true); //
.loadImageAssets()
Method
iC0
= new Image("
/bullet.png
", 64, 24, true, false,
true);
iC1
= new Image("
/cheese.png
", 32, 29, true, false,
true);
iBeagle
= new Enemy("M0 6 L0 52 70 52 70 70 70 93 115 45
115 0 84 0 68 16 Z",
520
,
160
, iE0);
iBullet
= new Projectile("M0 4 L0 16 64 16 64 4 Z",
8
,
8
, iC0);
iCheese
= new Projectile("M0 0 L0 32 29 32 29 0 Z",
96
,
8
, iC1); //
.createGameActors()
Method
root.getChildren().add(
iBeagle
.spriteFrame);
root.getChildren().add(
iBullet
.spriteFrame);
//
Add Objects to JavaFX Scene Graph
root.getChildren().add(
iCheese
.spriteFrame);
castDirector.addCurrentCast(iPR0, iPH0, iPV0, iPB0, iTR0,
iTR1,
iBeagle
,
iBullet
,
iCheese
);