Search in sources :

Example 16 with BaseMap

use of objects.BaseMap in project ultimate-java by pantinor.

the class GameScreen method attackAt.

public void attackAt(Maps combat, Creature cr) {
    Maps contextMap = Maps.get(context.getCurrentMap().getId());
    BaseMap combatMap = combat.getMap();
    TiledMap tmap = new UltimaTiledMapLoader(combat, Ultima4.standardAtlas, combat.getMap().getWidth(), combat.getMap().getHeight(), tilePixelWidth, tilePixelHeight).load();
    CombatScreen sc = new CombatScreen(this, context, contextMap, combatMap, tmap, cr.getTile(), Ultima4.creatures, Ultima4.standardAtlas);
    mainGame.setScreen(sc);
    currentEncounter = cr;
}
Also used : UltimaTiledMapLoader(util.UltimaTiledMapLoader) TiledMap(com.badlogic.gdx.maps.tiled.TiledMap) BaseMap(objects.BaseMap)

Example 17 with BaseMap

use of objects.BaseMap in project ultimate-java by pantinor.

the class GameScreen method loadNextMap.

public void loadNextMap(Maps m, int x, int y, int dngx, int dngy, int dngLevel, Direction orientation, boolean restoreSG) {
    log("Entering " + m.getLabel() + "!");
    BaseMap baseMap = m.getMap();
    if (baseMap.getType() == MapType.dungeon) {
        if (m != Maps.DELVE_SORROWS) {
            DungeonScreen sc = new DungeonScreen(this, context, m);
            if (restoreSG) {
                sc.restoreSaveGameLocation(dngx, dngy, dngLevel, orientation);
            }
            mainGame.setScreen(sc);
        } else {
            StaticGeneratedDungeonScreen sc = new StaticGeneratedDungeonScreen(this, context, m);
            if (restoreSG) {
                sc.restoreSaveGameLocation(dngx, dngy, dngLevel, orientation);
            }
            mainGame.setScreen(sc);
        }
    } else if (baseMap.getType() == MapType.shrine) {
        map = new UltimaTiledMapLoader(m, Ultima4.standardAtlas, baseMap.getWidth(), baseMap.getHeight(), tilePixelWidth, tilePixelHeight).load();
        context.setCurrentTiledMap(map);
        Virtue virtue = Virtue.get(baseMap.getId() - 25);
        ShrineScreen sc = new ShrineScreen(this, context.getParty(), virtue, map, Ultima4.standardAtlas, Ultima4.standardAtlas);
        mainGame.setScreen(sc);
    } else {
        context.setCurrentMap(baseMap);
        baseMap.removeJoinedPartyMemberFromPeopleList(context.getParty());
        map = new UltimaTiledMapLoader(m, Ultima4.standardAtlas, m.getMap().getWidth(), m.getMap().getHeight(), tilePixelWidth, tilePixelHeight).load();
        context.setCurrentTiledMap(map);
        if (renderer != null) {
            renderer.dispose();
        }
        renderer = new UltimaMapRenderer(context, Ultima4.standardAtlas, baseMap, map, 1f);
        mapBatch = renderer.getBatch();
        MapProperties prop = map.getProperties();
        mapPixelHeight = prop.get("height", Integer.class) * tilePixelHeight;
        baseMap.initObjects(this, Ultima4.standardAtlas, Ultima4.standardAtlas);
        renderer.getFOV().calculateFOV(baseMap.getShadownMap(), x, y, 17f);
        newMapPixelCoords = getMapPixelCoords(x, y);
    }
    if (Ultima4.playMusic) {
        if (Ultima4.music != null) {
            Ultima4.music.stop();
        }
        Sound snd = Sound.valueOf(baseMap.getMusic());
        Ultima4.music = Sounds.play(snd, Ultima4.musicVolume);
    }
}
Also used : UltimaTiledMapLoader(util.UltimaTiledMapLoader) UltimaMapRenderer(util.UltimaMapRenderer) MapProperties(com.badlogic.gdx.maps.MapProperties) StaticGeneratedDungeonScreen(generator.StaticGeneratedDungeonScreen) BaseMap(objects.BaseMap) StaticGeneratedDungeonScreen(generator.StaticGeneratedDungeonScreen)

Aggregations

BaseMap (objects.BaseMap)17 MapSet (objects.MapSet)10 TileSet (objects.TileSet)10 File (java.io.File)7 JAXBContext (javax.xml.bind.JAXBContext)7 Unmarshaller (javax.xml.bind.Unmarshaller)7 Tile (objects.Tile)7 FileHandle (com.badlogic.gdx.files.FileHandle)5 TextureAtlasData (com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData)5 Region (com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData.Region)5 FileInputStream (java.io.FileInputStream)4 Vector3 (com.badlogic.gdx.math.Vector3)3 InputStream (java.io.InputStream)3 Person (objects.Person)3 Portal (objects.Portal)3 TiledMap (com.badlogic.gdx.maps.tiled.TiledMap)2 ArrayList (java.util.ArrayList)2 Creature (objects.Creature)2 Drawable (objects.Drawable)2 Moongate (objects.Moongate)2