use of util.DungeonTileModelInstance in project ultimate-java by pantinor.
the class DungeonScreen method getChest.
public void getChest(int index, int x, int y) {
try {
DungeonTileModelInstance chest = null;
for (DungeonTileModelInstance dmi : modelInstances) {
if (dmi.getTile() == DungeonTile.CHEST) {
if (dmi.x == x && dmi.y == y && dmi.getLevel() == currentLevel) {
chest = dmi;
break;
}
}
}
if (chest != null) {
PartyMember pm = context.getParty().getMember(index);
context.getChestTrapHandler(pm);
log(String.format("The Chest Holds: %d Gold", context.getParty().getChestGold()));
// remove chest model instance
modelInstances.remove(chest);
dungeonTiles[currentLevel][x][y] = DungeonTile.NOTHING;
} else {
log("Not Here!");
}
} catch (PartyDeathException e) {
partyDeath();
}
}
use of util.DungeonTileModelInstance in project ultimate-java by pantinor.
the class DungeonScreen method endCombat.
@Override
public void endCombat(boolean isWon, BaseMap combatMap, boolean wounded) {
mainGame.setScreen(this);
if (isWon) {
if (currentEncounter != null) {
log("Victory!");
context.getParty().adjustKarma(KarmaAction.KILLED_EVIL);
int x = (Math.round(currentPos.x) - 1);
int y = (Math.round(currentPos.z) - 1);
/* add a chest, if the creature leaves one */
if (!currentEncounter.getNochest() && dungeonTiles[currentLevel][x][y] == DungeonTile.NOTHING) {
ModelInstance instance = new ModelInstance(chestModel, x + .5f, 0, y + .5f);
instance.nodes.get(0).scale.set(.010f, .010f, .010f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, DungeonTile.CHEST, currentLevel);
in.x = x;
in.y = y;
modelInstances.add(in);
dungeonTiles[currentLevel][x][y] = DungeonTile.CHEST;
}
}
} else {
if (combatMap.getType() == MapType.combat && context.getParty().didAnyoneFlee()) {
log("Battle is lost!");
// no flee penalty in dungeons
} else if (!context.getParty().isAnyoneAlive()) {
partyDeath();
}
}
if (currentEncounter != null) {
dngMap.getMap().removeCreature(currentEncounter);
currentEncounter = null;
}
// if exiting dungeon rooms, move out of the room with orientation to next coordinate
if (combatMap.getType() == MapType.dungeon) {
Direction exitDirection = context.getParty().getActivePartyMember().combatMapExitDirection;
if (exitDirection != null) {
currentDir = exitDirection;
int x = (Math.round(currentPos.x) - 1);
int y = (Math.round(currentPos.z) - 1);
// check for portal to another dungeon
for (Portal p : combatMap.getPortals()) {
if (p.getX() == x && p.getY() == y && p.getExitDirection() == exitDirection) {
Maps m = Maps.get(p.getDestmapid());
if (m == dngMap) {
break;
}
log("Entering " + m.getLabel() + "!");
DungeonScreen sc = new DungeonScreen(this.gameScreen, this.context, m);
sc.restoreSaveGameLocation(p.getStartx(), p.getStarty(), p.getStartlevel(), currentDir);
mainGame.setScreen(sc);
this.gameScreen.newMapPixelCoords = this.gameScreen.getMapPixelCoords(p.getRetroActiveDest().getX(), p.getRetroActiveDest().getY());
return;
}
}
if (exitDirection == Direction.EAST) {
x = x + 1;
if (x > 7) {
x = 0;
}
} else if (exitDirection == Direction.WEST) {
x = x - 1;
if (x < 0) {
x = 7;
}
} else if (exitDirection == Direction.NORTH) {
y = y - 1;
if (y < 0) {
y = 7;
}
} else if (exitDirection == Direction.SOUTH) {
y = y + 1;
if (y > 7) {
y = 0;
}
}
DungeonTile tile = dungeonTiles[currentLevel][x][y];
try {
if (tile != DungeonTile.WALL) {
currentPos = new Vector3(x + .5f, .5f, y + .5f);
camera.position.set(currentPos);
if (currentDir == Direction.EAST) {
camera.lookAt(currentPos.x + 1, currentPos.y, currentPos.z);
} else if (currentDir == Direction.WEST) {
camera.lookAt(currentPos.x - 1, currentPos.y, currentPos.z);
} else if (currentDir == Direction.NORTH) {
camera.lookAt(currentPos.x, currentPos.y, currentPos.z - 1);
} else if (currentDir == Direction.SOUTH) {
camera.lookAt(currentPos.x, currentPos.y, currentPos.z + 1);
}
checkTileAffects(tile, x, y);
moveMiniMapIcon();
}
} catch (PartyDeathException e) {
partyDeath();
}
if (tile.getValue() >= 208 && tile.getValue() <= 223) {
RoomLocater loc = null;
for (RoomLocater r : locaters) {
if (r.z == currentLevel && r.x == x && r.y == y) {
loc = r;
break;
}
}
enterRoom(loc, Direction.reverse(currentDir));
}
}
}
}
use of util.DungeonTileModelInstance in project ultimate-java by pantinor.
the class DungeonScreen method addBlock.
public void addBlock(int level, DungeonTile tile, float tx, float ty, float tz) {
ModelBuilder builder = new ModelBuilder();
if (tile == DungeonTile.WALL) {
Model model = builder.createBox(1, 1, 1, new Material(TextureAttribute.createDiffuse(assets.get("assets/graphics/mortar.png", Texture.class))), Usage.Position | Usage.Normal | Usage.TextureCoordinates);
ModelInstance instance = new ModelInstance(model, tx, ty, tz);
// rotate so the texture is aligned right
instance.transform.setFromEulerAngles(0, 0, 90).trn(tx, ty, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
} else if (tile.getValue() >= 144 && tile.getValue() <= 148) {
ModelInstance instance = new ModelInstance(fountainModel, tx - .15f, 0, tz + .2f);
instance.nodes.get(0).scale.set(.010f, .010f, .010f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
} else if (tile.getValue() >= 10 && tile.getValue() <= 48) {
ModelInstance instance = new ModelInstance(ladderModel, tx, 0, tz);
instance.nodes.get(0).scale.set(.060f, .060f, .060f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
Model manhole = builder.createCylinder(.75f, .02f, .75f, 32, new Material(ColorAttribute.createDiffuse(Color.DARK_GRAY)), Usage.Position | Usage.Normal);
if (tile == DungeonTile.LADDER_DOWN) {
instance = new ModelInstance(manhole, tx, 0, tz);
modelInstances.add(new DungeonTileModelInstance(instance, tile, level));
} else if (tile == DungeonTile.LADDER_UP) {
instance = new ModelInstance(manhole, tx, 1, tz);
modelInstances.add(new DungeonTileModelInstance(instance, tile, level));
} else if (tile == DungeonTile.LADDER_UP_DOWN) {
instance = new ModelInstance(manhole, tx, 0, tz);
modelInstances.add(new DungeonTileModelInstance(instance, tile, level));
instance = new ModelInstance(manhole, tx, 1, tz);
modelInstances.add(new DungeonTileModelInstance(instance, tile, level));
}
} else if (tile == DungeonTile.CHEST) {
ModelInstance instance = new ModelInstance(chestModel, tx, 0, tz);
instance.nodes.get(0).scale.set(.010f, .010f, .010f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
in.x = (int) tx;
in.y = (int) tz;
} else if (tile == DungeonTile.ORB) {
ModelInstance instance = new ModelInstance(orbModel, tx, .5f, tz);
instance.nodes.get(0).scale.set(.0025f, .0025f, .0025f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
in.x = (int) tx;
in.y = (int) tz;
modelInstances.add(in);
} else if (tile == DungeonTile.ALTAR) {
ModelInstance instance = new ModelInstance(altarModel, tx, 0, tz);
instance.nodes.get(0).scale.set(.0040f, .0040f, .0040f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
in.x = (int) tx;
in.y = (int) tz;
modelInstances.add(in);
} else if (tile.getValue() >= 160 && tile.getValue() <= 163) {
Color c = Color.GREEN;
if (tile == DungeonTile.FIELD_ENERGY) {
c = Color.BLUE;
}
if (tile == DungeonTile.FIELD_FIRE) {
c = Color.RED;
}
if (tile == DungeonTile.FIELD_SLEEP) {
c = Color.PURPLE;
}
Model model = builder.createBox(1, 1, 1, new Material(ColorAttribute.createDiffuse(c), ColorAttribute.createSpecular(c), new BlendingAttribute(0.7f)), Usage.Position | Usage.Normal);
ModelInstance instance = new ModelInstance(model, tx, .5f, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
in.x = (int) tx;
in.y = (int) tz;
} else if (tile.getValue() >= 208 && tile.getValue() <= 223) {
// room indicator
Model model = builder.createBox(1, 1, 1, new Material(ColorAttribute.createDiffuse(Color.DARK_GRAY), ColorAttribute.createSpecular(Color.DARK_GRAY), new BlendingAttribute(0.6f)), Usage.Position | Usage.Normal);
ModelInstance instance = new ModelInstance(model, tx, .5f, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
} else if (tile == DungeonTile.DOOR || tile == DungeonTile.SECRET_DOOR) {
Model model = builder.createBox(1, 1, 1, new Material(TextureAttribute.createDiffuse(assets.get("assets/graphics/mortar.png", Texture.class))), Usage.Position | Usage.TextureCoordinates | Usage.Normal);
ModelInstance instance = new ModelInstance(model, tx, ty, tz);
instance.transform.setFromEulerAngles(0, 0, 90).trn(tx, ty, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
Material matDoor = null;
if (tile == DungeonTile.DOOR) {
matDoor = new Material(TextureAttribute.createDiffuse(assets.get("assets/graphics/door.png", Texture.class)));
} else {
matDoor = new Material(new Material(ColorAttribute.createDiffuse(Color.DARK_GRAY), ColorAttribute.createSpecular(Color.DARK_GRAY), new BlendingAttribute(0.3f)));
}
model = builder.createBox(1.04f, .85f, .6f, matDoor, Usage.Position | Usage.TextureCoordinates | Usage.Normal);
instance = new ModelInstance(model, tx, .4f, tz);
in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
model = builder.createBox(.6f, .85f, 1.04f, matDoor, Usage.Position | Usage.TextureCoordinates | Usage.Normal);
instance = new ModelInstance(model, tx, .4f, tz);
in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
}
}
use of util.DungeonTileModelInstance in project ultimate-java by pantinor.
the class StaticGeneratedDungeonScreen method addBlock.
public void addBlock(int level, DungeonTile tile, float tx, float ty, float tz) {
ModelBuilder builder = new ModelBuilder();
if (tile == DungeonTile.WALL) {
Model model = builder.createBox(1, 1, 1, getMaterial(assets.get("assets/graphics/mortar.png", Texture.class)), Usage.Position | Usage.Normal | Usage.TextureCoordinates);
ModelInstance instance = new ModelInstance(model, tx, ty, tz);
// rotate so the texture is aligned right
instance.transform.setFromEulerAngles(0, 0, 90).trn(tx, ty, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
} else if (tile.getValue() >= 144 && tile.getValue() <= 148) {
ModelInstance instance = new ModelInstance(fountainModel, tx - .15f, 0, tz + .2f);
instance.nodes.get(0).scale.set(.010f, .010f, .010f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
} else if (tile == DungeonTile.ROCKS) {
ModelInstance instance = new ModelInstance(rocksModel, tx, 0, tz);
instance.nodes.get(0).scale.set(.010f, .010f, .010f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
} else if (tile == DungeonTile.MOONGATE) {
Color c = Color.CYAN;
Model model = builder.createBox(1, 1, 1, getMaterial(c, .7f), Usage.Position | Usage.Normal);
ModelInstance instance = new ModelInstance(model, tx, .5f, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
in.x = (int) tx;
in.y = (int) tz;
} else if (tile.getValue() >= 10 && tile.getValue() <= 48) {
ModelInstance instance = new ModelInstance(ladderModel, tx, 0, tz);
instance.nodes.get(0).scale.set(.060f, .060f, .060f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
Model manhole = builder.createCylinder(.75f, .02f, .75f, 32, getMaterial(Color.DARK_GRAY, 1), Usage.Position | Usage.Normal);
if (tile == DungeonTile.LADDER_DOWN) {
instance = new ModelInstance(manhole, tx, 0, tz);
modelInstances.add(new DungeonTileModelInstance(instance, tile, level));
} else if (tile == DungeonTile.LADDER_UP) {
instance = new ModelInstance(manhole, tx, 1, tz);
modelInstances.add(new DungeonTileModelInstance(instance, tile, level));
} else if (tile == DungeonTile.LADDER_UP_DOWN) {
instance = new ModelInstance(manhole, tx, 0, tz);
modelInstances.add(new DungeonTileModelInstance(instance, tile, level));
instance = new ModelInstance(manhole, tx, 1, tz);
modelInstances.add(new DungeonTileModelInstance(instance, tile, level));
}
} else if (tile == DungeonTile.CHEST) {
ModelInstance instance = new ModelInstance(chestModel, tx, 0, tz);
instance.nodes.get(0).scale.set(.010f, .010f, .010f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
in.x = (int) tx;
in.y = (int) tz;
} else if (tile == DungeonTile.COLUMN) {
Model sf = builder.createCylinder(.35f, 2.5f, .35f, 32, getMaterial(assets.get("assets/graphics/Stone_Masonry.jpg", Texture.class)), Usage.Position | Usage.TextureCoordinates | Usage.Normal);
ModelInstance instance = new ModelInstance(sf);
instance.transform.setToTranslation(tx, 0, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
in.x = (int) tx;
in.y = (int) tz;
modelInstances.add(in);
} else if (tile == DungeonTile.ORB) {
ModelInstance instance = new ModelInstance(orbModel, tx, .5f, tz);
instance.nodes.get(0).scale.set(.0025f, .0025f, .0025f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
in.x = (int) tx;
in.y = (int) tz;
modelInstances.add(in);
} else if (tile == DungeonTile.ALTAR) {
ModelInstance instance = new ModelInstance(altarModel, tx, 0, tz);
instance.nodes.get(0).scale.set(.0040f, .0040f, .0040f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
in.x = (int) tx;
in.y = (int) tz;
modelInstances.add(in);
} else if (tile == DungeonTile.LIGHT) {
// PointLight pl = new PointLight().set(nll2.x, nll2.y, nll2.z, tx, .8f, tz, 2f);
// DirectionalLight pl = new DirectionalLight().set(nll2.x, nll2.y, nll2.z, tx, .8f, tz);
// environment[level].add(pl);
// Model lm = builder.createSphere(.02f, .02f, .02f, 10, 10, getMaterial(new Color(nll2.x, nll2.y, nll2.z, 1), .7f), Usage.Position);
// ModelInstance instance = new ModelInstance(lm);
// instance.transform.setToTranslation(tx, .8f, tz);
// DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
// in.x=(int)tx; in.y=(int)tz;
// modelInstances.add(in);
} else if (tile == DungeonTile.FIRE) {
ModelInstance instance = new ModelInstance(campfireModel, tx, 0, tz);
instance.nodes.get(0).scale.set(.510f, .510f, .510f);
instance.calculateTransforms();
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
} else if (tile.getValue() >= 160 && tile.getValue() <= 163) {
Color c = Color.GREEN;
if (tile == DungeonTile.FIELD_ENERGY) {
c = Color.BLUE;
}
if (tile == DungeonTile.FIELD_FIRE) {
c = Color.RED;
}
if (tile == DungeonTile.FIELD_SLEEP) {
c = Color.PURPLE;
}
Model model = builder.createBox(1, 1, 1, getMaterial(c, .7f), Usage.Position | Usage.Normal);
ModelInstance instance = new ModelInstance(model, tx, .5f, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
in.x = (int) tx;
in.y = (int) tz;
} else if (tile == DungeonTile.DOOR || tile == DungeonTile.SECRET_DOOR || tile == DungeonTile.LOCKED_DOOR) {
Model model = builder.createBox(1, 1, 1, getMaterial(assets.get("assets/graphics/mortar.png", Texture.class)), Usage.Position | Usage.TextureCoordinates | Usage.Normal);
ModelInstance instance = new ModelInstance(model, tx, ty, tz);
instance.transform.setFromEulerAngles(0, 0, 90).trn(tx, ty, tz);
DungeonTileModelInstance in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
Material matDoor = null;
if (tile == DungeonTile.DOOR || tile == DungeonTile.LOCKED_DOOR) {
matDoor = getMaterial(assets.get("assets/graphics/door.png", Texture.class));
} else {
matDoor = getMaterial(Color.DARK_GRAY, .3f);
}
model = builder.createBox(1.04f, .85f, .6f, matDoor, Usage.Position | Usage.TextureCoordinates | Usage.Normal);
instance = new ModelInstance(model, tx, .4f, tz);
in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
model = builder.createBox(.6f, .85f, 1.04f, matDoor, Usage.Position | Usage.TextureCoordinates | Usage.Normal);
instance = new ModelInstance(model, tx, .4f, tz);
in = new DungeonTileModelInstance(instance, tile, level);
modelInstances.add(in);
}
}
use of util.DungeonTileModelInstance in project ultimate-java by pantinor.
the class StaticGeneratedDungeonScreen method init.
public void init() {
assets = new AssetManager();
assets.load("assets/graphics/dirt.png", Texture.class);
assets.load("assets/graphics/map.png", Texture.class);
assets.load("assets/graphics/Stone_Masonry.jpg", Texture.class);
assets.load("assets/graphics/door.png", Texture.class);
assets.load("assets/graphics/mortar.png", Texture.class);
assets.load("assets/graphics/rock.png", Texture.class);
assets.update(2000);
assets.get("assets/graphics/rock.png", Texture.class).setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
assets.get("assets/graphics/door.png", Texture.class).setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
assets.get("assets/graphics/mortar.png", Texture.class).setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
assets.get("assets/graphics/dirt.png", Texture.class).setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
ModelLoader<?> gloader = new G3dModelLoader(new UBJsonReader());
fountainModel = gloader.loadModel(Gdx.files.internal("assets/graphics/fountain2.g3db"));
ladderModel = gloader.loadModel(Gdx.files.internal("assets/graphics/ladder.g3db"));
chestModel = gloader.loadModel(Gdx.files.internal("assets/graphics/chest.g3db"));
orbModel = gloader.loadModel(Gdx.files.internal("assets/graphics/orb.g3db"));
altarModel = gloader.loadModel(Gdx.files.internal("assets/graphics/altar.g3db"));
rocksModel = gloader.loadModel(Gdx.files.internal("assets/graphics/rocks.g3db"));
campfireModel = gloader.loadModel(Gdx.files.internal("assets/graphics/campfire.g3db"));
font = new BitmapFont();
font.setColor(Color.WHITE);
fixedLight = new PointLight().set(1f, 0.8f, 0.6f, 4f, 4f, 4f, 5f);
modelBatch = new ModelBatch();
batch = new SpriteBatch();
camera = new PerspectiveCamera(67, Ultima4.MAP_WIDTH, Ultima4.MAP_HEIGHT);
camera.near = 0.1f;
camera.far = 1000f;
decalBatch = new DecalBatch(new CameraGroupStrategy(camera));
// inputController = new CameraInputController(camera);
// inputController.rotateLeftKey = inputController.rotateRightKey = inputController.forwardKey = inputController.backwardKey = 0;
// inputController.translateUnits = 30f;
ModelBuilder builder = new ModelBuilder();
Model fm = builder.createBox(1, 1, 1, new Material(TextureAttribute.createDiffuse(assets.get("assets/graphics/rock.png", Texture.class))), Usage.Position | Usage.TextureCoordinates | Usage.Normal);
Model cm = builder.createBox(1, 1, 1, new Material(TextureAttribute.createDiffuse(assets.get("assets/graphics/dirt.png", Texture.class))), Usage.Position | Usage.TextureCoordinates | Usage.Normal);
try {
int TILE_SIZE = 16;
FileHandle f = new FileHandle("assets/tilemaps/tiles-vga-atlas.txt");
TextureAtlasData a = new TextureAtlasData(f, f.parent(), false);
mapTileIds = new String[a.getRegions().size + 1];
for (Region r : a.getRegions()) {
int x = r.left / r.width;
int y = r.top / r.height;
int i = y * TILE_SIZE + x + 1;
mapTileIds[i] = r.name;
}
TiledMap map = new TmxMapLoader().load("assets/tilemaps/delveOfSorrows.tmx");
Iterator<MapLayer> iter = map.getLayers().iterator();
int level = 0;
while (iter.hasNext()) {
environment[level] = new Environment();
environment[level].set(new ColorAttribute(ColorAttribute.Ambient, 0.5f, 0.5f, 0.5f, 1f));
environment[level].add(fixedLight);
layers[level] = (TiledMapTileLayer) iter.next();
for (int y = 0; y < DUNGEON_MAP; y++) {
for (int x = 0; x < DUNGEON_MAP; x++) {
String val = mapTileIds[layers[level].getCell(x, DUNGEON_MAP - y - 1).getTile().getId()];
DungeonTile tile = DungeonTile.getTileByName(val);
if (tile == null) {
CreatureType ct = CreatureType.get(val);
if (ct != null) {
Creature creature = Ultima4.creatures.getInstance(ct, Ultima4.standardAtlas);
creature.currentX = x;
creature.currentY = y;
creature.currentLevel = level;
creature.getDecal().setPosition(creature.currentX + .5f, .3f, creature.currentY + .5f);
dngMap.getMap().addCreature(creature);
} else {
System.err.println(val);
}
dungeonTiles[level][x][y] = DungeonTile.NOTHING;
} else if (tile == DungeonTile.WATER) {
Model w = builder.createBox(1, 1, 1, getMaterial(Color.BLUE, .9f), Usage.Position | Usage.Normal);
ModelInstance wi = new ModelInstance(w, x + .5f, -.5f, y + .5f);
DungeonTileModelInstance fin = new DungeonTileModelInstance(wi, DungeonTile.WATER, level);
modelInstances.add(fin);
dungeonTiles[level][x][y] = DungeonTile.NOTHING;
} else {
dungeonTiles[level][x][y] = tile;
addBlock(level, tile, x + .5f, .5f, y + .5f);
}
if (tile == null || tile != DungeonTile.WATER) {
DungeonTileModelInstance fin = new DungeonTileModelInstance(new ModelInstance(fm, new Vector3(x + .5f, -.5f, y + .5f)), DungeonTile.FLOOR, level);
modelInstances.add(fin);
}
DungeonTileModelInstance cin = new DungeonTileModelInstance(new ModelInstance(cm, new Vector3(x + .5f, 1.5f, y + .5f)), DungeonTile.FLOOR, level);
modelInstances.add(cin);
}
}
level++;
}
setStartPosition();
camera.position.set(currentPos);
camera.lookAt(currentPos.x + 1, currentPos.y, currentPos.z);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations