Skip to content

Commit

Permalink
More 3D shapes as used in Junior Pac mazes
Browse files Browse the repository at this point in the history
  • Loading branch information
armin-reichert committed Jan 10, 2025
1 parent 1af24ce commit 39a3f5d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public enum ObstacleType {

O_SHAPE("dgfe", "dcgfce", "dgbfeb", "dcgbfceb"),

OPEN_SQUARE_NW("dgbecfbgcedcgbfceb"),
OPEN_SQUARE_NE("dcgbfcedcfbgcdbfeb"),
OPEN_SQUARE_SE("dcgbfebgcdbecgfceb"),
OPEN_SQUARE_SW("dcgfcdbecfbdgbfceb"),

S_SHAPE(
"dcfdgbfcdfeb",
"dgecgbfegceb",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import javafx.util.Duration;
import org.tinylog.Logger;

import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;
Expand Down Expand Up @@ -232,7 +234,7 @@ private Node createLevelCounter3D(GameSpriteSheet spriteSheet, List<Byte> symbol
}

private void buildWorld3D(GameWorld world, WorldMapColoring coloring) {
Logger.info("Build world 3D from map {}", world.map().url());
Logger.info("Build world 3D. Map URL='{}'", URLDecoder.decode(world.map().url().toExternalForm(), StandardCharsets.UTF_8));

createFloor(world.map().terrain().numCols() * TS, world.map().terrain().numRows() * TS);
worldGroup.getChildren().add(floor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ public void renderObstacle3D(Group parent, Obstacle obstacle) {
case LLL_SHAPE -> addLShapeTriple(parent, obstacle);
case LLL_SHAPE_MIRRORED -> addLShapeTripleMirrored(parent, obstacle);
case O_SHAPE -> addOShape3D(parent, obstacle);
case OPEN_SQUARE_SE -> addOpenSquareSE(parent, obstacle);
case OPEN_SQUARE_SW -> addOpenSquareSW(parent, obstacle);
case OPEN_SQUARE_NE -> addOpenSquareNE(parent, obstacle);
case OPEN_SQUARE_NW -> addOpenSquareNW(parent, obstacle);
case S_SHAPE -> addSShape3D(parent, obstacle);
case T_SHAPE -> addTShape3D(parent, obstacle);
case T_SHAPE_TWO_ROWS -> addTShapeTwoRows3D(parent, obstacle);
Expand Down Expand Up @@ -598,6 +602,41 @@ private void addSpaceShipDown(Group parent, Obstacle obstacle) {
addWall(parent, t[3], t[4]);
}

private void addOpenSquareSE(Group parent, Obstacle obstacle) {
Vector2f[] t = obstacle.cornerCenters(0, 2, 4, 13, 16);
addTowers(parent, t);
addWall(parent, t[0], t[1]);
addWall(parent, t[1], t[2]);
addWall(parent, t[0], t[4]);
addWall(parent, t[3], t[4]);
}

private void addOpenSquareSW(Group parent, Obstacle obstacle) {
Vector2f[] t = obstacle.cornerCenters(0, 2, 11, 14, 16);
addTowers(parent, t);
addWall(parent, t[0], t[1]);
addWall(parent, t[0], t[4]);
addWall(parent, t[2], t[3]);
addWall(parent, t[3], t[4]);
}

private void addOpenSquareNE(Group parent, Obstacle obstacle) {
Vector2f[] t = obstacle.cornerCenters(0, 2, 4, 6, 15);
addTowers(parent, t);
addWall(parent, t[0], t[1]);
addWall(parent, t[1], t[2]);
addWall(parent, t[2], t[3]);
addWall(parent, t[0], t[4]);
}

private void addOpenSquareNW(Group parent, Obstacle obstacle) {
Vector2f[] t = obstacle.cornerCenters(0, 9, 12, 14, 16);
addTowers(parent, t);
addWall(parent, t[0], t[4]);
addWall(parent, t[4], t[3]);
addWall(parent, t[3], t[2]);
addWall(parent, t[2], t[1]);
}

// Junior Pac-Man maze obstacles. TODO: move elsewhere

Expand Down

0 comments on commit 39a3f5d

Please sign in to comment.