Commit 3507ce4f authored by Matyáš Latner's avatar Matyáš Latner

Merge branch 'feature-inthedarkness' into 'V3.4'

#286 Simplification of game In the darkness

* Simplified levels in game
* Faster animation when replying actions

See merge request !483
parents 14a55cc8 e1f232af
......@@ -24,6 +24,7 @@ import java.util.Random;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
import cz.nic.tablexia.game.games.in_the_darkness.action.InTheDarknessActionType;
import cz.nic.tablexia.game.games.in_the_darkness.map.IMapProvider;
import cz.nic.tablexia.game.games.in_the_darkness.map.InTheDarknessMap;
import cz.nic.tablexia.game.games.in_the_darkness.map.MapGenerator;
import cz.nic.tablexia.game.games.in_the_darkness.map.MapTutorial;
import cz.nic.tablexia.util.Log;
......@@ -36,23 +37,25 @@ import cz.nic.tablexia.util.Log;
*/
public enum InTheDarknessDifficulty {
TUTORIAL(GameDifficulty.TUTORIAL, false, MapTutorial.class, 1, Arrays.asList(new InTheDarknessActionType[]{})),
EASY (GameDifficulty.EASY, true, MapGenerator.class, 1, Arrays.asList(new InTheDarknessActionType[]{})),
MEDIUM (GameDifficulty.MEDIUM, true, MapGenerator.class, 1, Arrays.asList(new InTheDarknessActionType[]{InTheDarknessActionType.KEY})),
HARD (GameDifficulty.HARD, true, MapGenerator.class, 2, Arrays.asList(new InTheDarknessActionType[]{InTheDarknessActionType.KEY}));
TUTORIAL(GameDifficulty.TUTORIAL, false, MapTutorial.class, 1, Arrays.asList(new InTheDarknessActionType[]{}), InTheDarknessMap.SMALL_MAP),
EASY (GameDifficulty.EASY, true, MapGenerator.class, 1, Arrays.asList(new InTheDarknessActionType[]{}), InTheDarknessMap.SMALL_MAP),
MEDIUM (GameDifficulty.MEDIUM, true, MapGenerator.class, 1, Arrays.asList(new InTheDarknessActionType[]{}), InTheDarknessMap.LARGE_MAP),
HARD (GameDifficulty.HARD, true, MapGenerator.class, 1, Arrays.asList(new InTheDarknessActionType[]{InTheDarknessActionType.KEY}), InTheDarknessMap.LARGE_MAP);
private GameDifficulty gameDifficulty;
private int floorCount;
private InTheDarknessMap map;
private List<InTheDarknessActionType> difficultyInTheDarknessActionTypes;
private Class<? extends IMapProvider> mapProviderClass;
private boolean hasResults;
InTheDarknessDifficulty(GameDifficulty gameDifficulty, boolean hasResults, Class<? extends IMapProvider> mapProviderClass, int floorCount, List<InTheDarknessActionType> difficultyInTheDarknessActionTypes) {
InTheDarknessDifficulty(GameDifficulty gameDifficulty, boolean hasResults, Class<? extends IMapProvider> mapProviderClass, int floorCount, List<InTheDarknessActionType> difficultyInTheDarknessActionTypes, InTheDarknessMap map) {
this.gameDifficulty = gameDifficulty;
this.hasResults = hasResults;
this.mapProviderClass = mapProviderClass;
this.floorCount = floorCount;
this.difficultyInTheDarknessActionTypes = difficultyInTheDarknessActionTypes;
this.map = map;
}
public boolean hasResults() {
......@@ -62,7 +65,11 @@ public enum InTheDarknessDifficulty {
public int getFloorCount() {
return floorCount;
}
public InTheDarknessMap getMap() {
return map;
}
public boolean hasDifficultyActionType(InTheDarknessActionType inTheDarknessActionType) {
return difficultyInTheDarknessActionTypes.contains(inTheDarknessActionType);
}
......
......@@ -26,7 +26,8 @@ public final class InTheDarknessAssets {
public static final String BACKGROUND_PATH = GFX_PATH + "background/";
public static final String BACKGROUND = BACKGROUND_PATH + "background";
public static final String BACKGROUND_MAP = BACKGROUND_PATH + "background_map";
public static final String BACKGROUND_SMALL_MAP = BACKGROUND_PATH + "background_small_map";
public static final String BACKGROUND_LARGE_MAP = BACKGROUND_PATH + "background_large_map";
public static final String BACKGROUND_ACTIONS = BACKGROUND_PATH + "background_actions";
public static final String OBJECTS_PATH = GFX_PATH + "objects/";
......
......@@ -284,7 +284,7 @@ public class Player extends Group {
}
private float getPlayerPositionYForTileMapPosition(int mapStartPositionY, TileMapPosition tileMapPosition) {
return mapStartPositionY + ((InTheDarknessGame.MAP_Y_SIZE - tileMapPosition.getPositionY() - 1) * InTheDarknessGame.TILE_SIZE) + (InTheDarknessGame.TILE_SIZE / 2) - (actualPlayerAnimatedImage.getHeight() / 2);
return mapStartPositionY + ((InTheDarknessGame.mapSizeY - tileMapPosition.getPositionY() - 1) * InTheDarknessGame.TILE_SIZE) + (InTheDarknessGame.TILE_SIZE / 2) - (actualPlayerAnimatedImage.getHeight() / 2);
}
private AnimatedImage createPlayerAnimatedImage(int width, int height, String animationName, int framesCount, InTheDarknessGame inTheDarknessGame) {
......
/*
* Copyright (C) 2016 CZ.NIC, z.s.p.o. <info@tablexia.cz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.game.games.in_the_darkness.map;
import cz.nic.tablexia.game.games.in_the_darkness.assets.InTheDarknessAssets;
public enum InTheDarknessMap {
SMALL_MAP(InTheDarknessAssets.BACKGROUND_SMALL_MAP, 5, 6),
LARGE_MAP(InTheDarknessAssets.BACKGROUND_LARGE_MAP, 7, 6);
private String mapTexture;
private int sizeX;
private int sizeY;
InTheDarknessMap(String mapTexture, int sizeX, int sizeY) {
this.mapTexture = mapTexture;
this.sizeX = sizeX;
this.sizeY = sizeY;
}
public String getMapTexture() {
return mapTexture;
}
public int getSizeY() {
return sizeY;
}
public int getSizeX() {
return sizeX;
}
}
......@@ -142,7 +142,7 @@ public class MapGenerator implements IMapProvider {
if (lastEndTile == null) {
// create entry tile
startPosition = InTheDarknessGame.DEFAULT_MAP_START_POSITION;
startPosition = InTheDarknessGame.defaultMapStartPosition;
startTile = new Tile(TileType.getRandomTileTypeForAvailableDoors(null, true, null, null, true, randomAccess));
} else {
startPosition = lastEndTile.getTileMapPosition();
......@@ -324,7 +324,7 @@ public class MapGenerator implements IMapProvider {
private boolean generatePathFromPointToPoint(TileMap tileMap, TileMapPosition startPosition, TileMapPosition finishPosition, boolean useOnlyFreeTiles, boolean generateFinalTile, List<TileMapPosition> bannedPositions) {
int generatorMaxCycleCounter = 0;
int generatorMaxCycleCount = InTheDarknessGame.MAP_X_SIZE * InTheDarknessGame.MAP_Y_SIZE;
int generatorMaxCycleCount = InTheDarknessGame.mapSizeX * InTheDarknessGame.mapSizeY;
int lastXPosition = startPosition.getPositionX();
int lastYPosition = startPosition.getPositionY();
......
......@@ -35,7 +35,7 @@ public class MapTutorial implements IMapProvider {
public TileMap prepareMap(Tile lastFinishTile, int mapXSize, int mapYSize, MapObjectType finishMapObject, boolean hasKey) {
TileMap tileMap = new TileMap(mapXSize, mapYSize);
TileMapPosition position1 = InTheDarknessGame.DEFAULT_MAP_START_POSITION;
TileMapPosition position1 = InTheDarknessGame.defaultMapStartPosition;
TileMapPosition position2 = new TileMapPosition(position1.getPositionX() - 1, position1.getPositionY());
TileMapPosition position3 = new TileMapPosition(position1.getPositionX() - 1, position1.getPositionY() - 1);
tileMap.setMapStartPosition(position1);
......
......@@ -92,7 +92,7 @@ public class MapObject {
float tileImageWidth = tileImage.getWidth();
float tileImageHeight = tileImage.getHeight();
mapObjectImage.setPosition((tile.getMapPositionX() * tileImageWidth) + (tileImageWidth * mapObjectType.getXOffsetRatio()), (InTheDarknessGame.MAP_Y_SIZE * InTheDarknessGame.TILE_SIZE) - (((tile.getMapPositionY() + 1) * tileImageHeight) - (tileImageHeight * mapObjectType.getYOffsetRatio())));
mapObjectImage.setPosition((tile.getMapPositionX() * tileImageWidth) + (tileImageWidth * mapObjectType.getXOffsetRatio()), (InTheDarknessGame.mapSizeY * InTheDarknessGame.TILE_SIZE) - (((tile.getMapPositionY() + 1) * tileImageHeight) - (tileImageHeight * mapObjectType.getYOffsetRatio())));
if (getMapObjectType().isRotable()) {
mapObjectImage.setOrigin(Align.center);
mapObjectImage.setRotation(-tile.getTileType().getRotation() * QUARTER_ROTATION);
......
......@@ -98,7 +98,7 @@ public class MapObstacle {
float tileImageHeight = tileImage.getHeight();
image.setPosition((tile.getMapPositionX() * tileImageWidth) + offsetX + (image.getWidth() * getMapObstacleType().getCorrectionOffsetX()),
(InTheDarknessGame.MAP_Y_SIZE * InTheDarknessGame.TILE_SIZE) - ((tile.getMapPositionY() + 1) * tileImageHeight) + offsetY + (image.getHeight() * getMapObstacleType().getCorrectionOffsetY()));
(InTheDarknessGame.mapSizeY * InTheDarknessGame.TILE_SIZE) - ((tile.getMapPositionY() + 1) * tileImageHeight) + offsetY + (image.getHeight() * getMapObstacleType().getCorrectionOffsetY()));
image.setOrigin(Align.center);
image.setRotation(-mapObstacleType.getRotation() * QUARTER_ROTATION);
return image;
......
......@@ -192,7 +192,7 @@ public class Tile {
}
public TileMapPosition getTilePosition() {
return new TileMapPosition((mapPositionX * InTheDarknessGame.TILE_SIZE), (InTheDarknessGame.MAP_Y_SIZE * InTheDarknessGame.TILE_SIZE) - ((mapPositionY + 1) * InTheDarknessGame.TILE_SIZE));
return new TileMapPosition((mapPositionX * InTheDarknessGame.TILE_SIZE), (InTheDarknessGame.mapSizeY * InTheDarknessGame.TILE_SIZE) - ((mapPositionY + 1) * InTheDarknessGame.TILE_SIZE));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment