Skip to content

Commit

Permalink
Merge VEHICLES, SHADOWS and OBSTACLES ZLevel into ON_GROUND
Browse files Browse the repository at this point in the history
  • Loading branch information
agateau committed Jul 27, 2023
1 parent 184dc16 commit f060e7a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions core/src/com/agateau/pixelwheels/ZLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

/** The drawing layers, ordered from bottom to top */
public enum ZLevel {
GROUND, // bgX layers, skidmarks, vehicle shadows, mines, bullets...
VEHICLES,
SHADOWS, // obstacle and helicopter shadows
OBSTACLES, // obstacles
FLYING_LOW, // missiles
FG_LAYERS, // fgX layers
GROUND, // bgX layers, skidmarks, vehicle and obstacle shadows, mines, bullets...
ON_GROUND, // vehicles, obstacles, bonus, mine
FLYING_LOW, // missiles, explosions, impacts
FG_LAYERS, // fgX layers, helicopter shadow
FLYING_HIGH, // helicopter, vehicles being carried by helicopter
}
2 changes: 1 addition & 1 deletion core/src/com/agateau/pixelwheels/bonus/BonusSpot.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) {
if (zLevel == ZLevel.GROUND) {
mDrawer.setBatch(batch);
mDrawer.drawShadow(mBody, mRegion);
} else if (zLevel == ZLevel.OBSTACLES) {
} else if (zLevel == ZLevel.ON_GROUND) {
mDrawer.setBatch(batch);
mDrawer.draw(mBody, mRegion);
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/com/agateau/pixelwheels/bonus/Mine.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) {
TextureRegion region = mAssets.mine.getKeyFrame(mTime);
mBodyRegionDrawer.drawShadow(mBody, region);
}
if (zLevel == ZLevel.VEHICLES) {
if (zLevel == ZLevel.ON_GROUND) {
TextureRegion region = mAssets.mine.getKeyFrame(mTime);
mBodyRegionDrawer.draw(mBody, region);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) {
if (mTime < 0) {
return;
}
if (zLevel != ZLevel.OBSTACLES) {
if (zLevel != ZLevel.FLYING_LOW) {
return;
}
TextureRegion region = mAnimation.getKeyFrame(mTime);
Expand Down
4 changes: 2 additions & 2 deletions core/src/com/agateau/pixelwheels/obstacles/Obstacle.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ public void act(float delta) {

@Override
public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) {
if (zLevel != ZLevel.OBSTACLES && zLevel != ZLevel.SHADOWS) {
if (zLevel != ZLevel.ON_GROUND && zLevel != ZLevel.GROUND) {
return;
}
if (!AgcMathUtils.rectangleContains(viewBounds, getPosition(), mRegionRadius)) {
return;
}
if (zLevel == ZLevel.OBSTACLES) {
if (zLevel == ZLevel.ON_GROUND) {
mBodyRegionDrawer.setBatch(batch);
mBodyRegionDrawer.draw(mBody, mRegion);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) {
}

// Vehicle level: wheels and body
ZLevel wantedZIndex = mVehicle.isFlying() ? ZLevel.FLYING_HIGH : ZLevel.VEHICLES;
ZLevel wantedZIndex = mVehicle.isFlying() ? ZLevel.FLYING_HIGH : ZLevel.ON_GROUND;
if (zLevel != wantedZIndex) {
return;
}
Expand Down

0 comments on commit f060e7a

Please sign in to comment.