1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2025-07-17 21:31:10 +00:00

change dela for change map

This commit is contained in:
2022-06-19 13:08:33 +02:00
parent 9e2e9dd739
commit adf854d15c
9 changed files with 23 additions and 850 deletions

View File

@ -52,13 +52,13 @@ public abstract class Character extends Entity{
super(name, x, y, map);
this.img = img;
imgBattle = "./Data/img/person/" + name + ".png";
imgBattle = "./img/person/" + name + ".png";
}
@Override
public void init() {
super.init();
ss = new Spritesheet("./Data/img/sprite/" + img + ".png", SPRITE_WIDTH, SPRITE_HEIGHT);
ss = new Spritesheet("./img/sprite/" + img + ".png", SPRITE_WIDTH, SPRITE_HEIGHT);
}
@Override

View File

@ -18,6 +18,8 @@ public class Player extends Character{
public boolean onEnemy = false;
private static final int XP_MAX = 6000;
public boolean onDoor;
private boolean moveBlocked;
private long beginBlocked;
/**
* Create a player
@ -46,6 +48,11 @@ public class Player extends Character{
public void manageEntity(ScreenMap sm, Controller c) {
onDoor = sm.isDoor(getPosition());
if(onDoor){
moveBlocked = true;
beginBlocked = System.currentTimeMillis();
}
if(System.currentTimeMillis() - beginBlocked >= Settings.SWITCH_MAP_TIME && !onDoor) { moveBlocked = false; }
// Do nothing if hero is already moving
if (!isMoving()) {
@ -57,19 +64,19 @@ public class Player extends Character{
if (c.keyStatus.get(Input.Keys.RIGHT) && !onDoor) {
if (c.keyStatus.get(Input.Keys.RIGHT) && !moveBlocked) {
goalDirection = Player.Direction.RIGHT;
nextCell = sm.getTile(getPosition(), 1, 0);
nextPos.x+=sm.tileWidth;
} else if (c.keyStatus.get(Input.Keys.LEFT) && !onDoor) {
} else if (c.keyStatus.get(Input.Keys.LEFT) && !moveBlocked) {
goalDirection = Player.Direction.LEFT;
nextCell = sm.getTile(getPosition(), -1, 0);
nextPos.x-=sm.tileWidth;
} else if (c.keyStatus.get(Input.Keys.UP) && !onDoor) {
} else if (c.keyStatus.get(Input.Keys.UP) && !moveBlocked) {
goalDirection = Player.Direction.UP;
nextCell = sm.getTile(getPosition(), 0, 1);
nextPos.y+=sm.tileHeight;
} else if (c.keyStatus.get(Input.Keys.DOWN) && !onDoor) {
} else if (c.keyStatus.get(Input.Keys.DOWN) && !moveBlocked) {
goalDirection = Player.Direction.DOWN;
nextCell = sm.getTile(getPosition(), 0, -1);
nextPos.y-=sm.tileHeight;

View File

@ -49,12 +49,12 @@ public class PokeHES extends PortableApplication {
// add player, create and add all enemies in entities
entities.add((Entity) sp.p);
enemies.add(new Enemy("Gloeckner", 1, 7, "21N307", 600, "allemand"));
enemies.add(new Enemy("Nicollier", 4, 2, "21N308", 1600, "mathematique"));
enemies.add(new Enemy("Mudry", 5, 11, "21N304", 700, "informatique"));
enemies.add(new Enemy("Ellert", 1, 4, "23N215", 300, "physique"));
enemies.add(new Enemy("Bianchi", 1, 3, "23N308", 1200, "electricite"));
enemies.add(new Enemy("Paciotti", 5, 11, "21N205", 1200, "mecanique"));
enemies.add(new Enemy("gloeckner", 1, 7, "21N307", 600, "allemand"));
enemies.add(new Enemy("nicollier", 4, 2, "21N308", 1600, "mathematique"));
enemies.add(new Enemy("mudry", 5, 11, "21N304", 700, "informatique"));
enemies.add(new Enemy("ellert", 1, 4, "23N215", 300, "physique"));
enemies.add(new Enemy("bianchi", 1, 3, "23N308", 1200, "electricite"));
enemies.add(new Enemy("paciotti", 5, 11, "21N205", 1200, "mecanique"));
for (Enemy enemy : enemies) { entities.add(enemy); }
//Init all entities

View File

@ -6,7 +6,7 @@ public class Settings {
public static final int PLAYERS = 1;
public static final int TIME = 15; // number of minutes for kill all enemy // should be 10
public static final int RECOVERED = 30; // number of seconds an enemy need for recovered
public static final int SWITCH_MAP_TIME = 1000; // Number of milliseconds the player wait for switch map
public static final int SWITCH_MAP_TIME = 500; // Number of milliseconds the player wait for switch map
public static final int SIDE = 800; // Do not change // TODO resize possible

View File

@ -36,7 +36,7 @@ public class ScreenMap extends RenderingScreen{
private Player player;
private void createMap(String name){
TiledMap tm =new TmxMapLoader().load("./Data/map/"+ name + ".tmx");
TiledMap tm =new TmxMapLoader().load("./map/"+ name + ".tmx");
tMap.put(name,tm);
tMapRenderer.put(name,new OrthogonalTiledMapRenderer(tm));
}
@ -180,7 +180,6 @@ public class ScreenMap extends RenderingScreen{
try { Door.nextMap = mapProperties.get("nextMap").toString(); } catch (Exception e) { }
try { Door.nextX = Integer.parseInt(mapProperties.get("nextX").toString()); } catch (Exception e) { }
try { Door.nextY = Integer.parseInt(mapProperties.get("nextY").toString()); } catch (Exception e) { }
try { Door.nextDirection = Character.Direction.valueOf(mapProperties.get("nextDirection").toString()); } catch (Exception e) { }
}

View File

@ -15,7 +15,7 @@ public class FightData {
public int nbr_line =0;
public FightData(String branch) {
file = new File("./Data/Battle/Fight/" + branch + ".csv");
file = new File("./data/battle/fight/" + branch + ".csv");
}
public void readFile() {

View File

@ -12,7 +12,7 @@ public class SpeechData {
File file;
public SpeechData(String name){
file = new File("./Data/Battle/Speech/" + name + ".txt");
file = new File("./data/battle/speech/" + name + ".txt");
}
public void readFile() {