mirror of
https://github.com/Klagarge/PokeHES.git
synced 2025-07-07 17:01:10 +00:00
Merge branch 'master' into xp-modifiaction
This commit is contained in:
@ -137,10 +137,10 @@ public abstract class Character extends Entity{
|
||||
textureY = 2;
|
||||
break;
|
||||
case LEFT:
|
||||
textureY = 1;
|
||||
textureY = 3;
|
||||
break;
|
||||
case UP:
|
||||
textureY = 3;
|
||||
textureY = 1;
|
||||
break;
|
||||
case DOWN:
|
||||
textureY = 0;
|
||||
|
@ -6,13 +6,17 @@ public class Enemy extends Character{
|
||||
|
||||
private String branch;
|
||||
|
||||
public Enemy(String name, int x, int y, String img, String map, int pv, String branch) {
|
||||
|
||||
|
||||
|
||||
public Enemy(String name, int x, int y, String img, String map, int pv, String branch, Character.Direction dir) {
|
||||
|
||||
super(name, x, y, img, map);
|
||||
//generate his text
|
||||
|
||||
this.map = map;
|
||||
|
||||
turn(Character.Direction.DOWN);
|
||||
turn(dir);
|
||||
|
||||
this.branch = branch;
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class Player extends Character{
|
||||
public boolean onEnemy = false;
|
||||
|
||||
public Player(int x, int y, String map) {
|
||||
super("Player", x, y, "Character", map);
|
||||
super("Player", x, y, "Character_flipped", map);
|
||||
}
|
||||
|
||||
public void addXp(int xp){
|
||||
@ -30,6 +30,8 @@ public class Player extends Character{
|
||||
|
||||
public void manageEntity(ScreenMap sm, Controller c) {
|
||||
|
||||
boolean onDoor = sm.isDoor(getPosition());
|
||||
|
||||
// Do nothing if hero is already moving
|
||||
if (!isMoving()) {
|
||||
|
||||
@ -38,19 +40,21 @@ public class Player extends Character{
|
||||
Player.Direction goalDirection = Player.Direction.NULL;
|
||||
Vector2 nextPos = new Vector2(position);
|
||||
|
||||
if (c.keyStatus.get(Input.Keys.RIGHT)) {
|
||||
|
||||
|
||||
if (c.keyStatus.get(Input.Keys.RIGHT) && !onDoor) {
|
||||
goalDirection = Player.Direction.RIGHT;
|
||||
nextCell = sm.getTile(getPosition(), 1, 0);
|
||||
nextPos.x+=sm.tileWidth;
|
||||
} else if (c.keyStatus.get(Input.Keys.LEFT)) {
|
||||
} else if (c.keyStatus.get(Input.Keys.LEFT) && !onDoor) {
|
||||
goalDirection = Player.Direction.LEFT;
|
||||
nextCell = sm.getTile(getPosition(), -1, 0);
|
||||
nextPos.x-=sm.tileWidth;
|
||||
} else if (c.keyStatus.get(Input.Keys.UP)) {
|
||||
} else if (c.keyStatus.get(Input.Keys.UP) && !onDoor) {
|
||||
goalDirection = Player.Direction.UP;
|
||||
nextCell = sm.getTile(getPosition(), 0, 1);
|
||||
nextPos.y+=sm.tileHeight;
|
||||
} else if (c.keyStatus.get(Input.Keys.DOWN)) {
|
||||
} else if (c.keyStatus.get(Input.Keys.DOWN) && !onDoor) {
|
||||
goalDirection = Player.Direction.DOWN;
|
||||
nextCell = sm.getTile(getPosition(), 0, -1);
|
||||
nextPos.y-=sm.tileHeight;
|
||||
@ -63,7 +67,7 @@ public class Player extends Character{
|
||||
turn(goalDirection);
|
||||
System.out.println("It's a enemy !!");
|
||||
} else {
|
||||
setSpeed(sm.getSpeed(nextCell));
|
||||
setSpeed(sm.getSpeed(nextCell)*3); //TODO remove x3
|
||||
go(goalDirection);
|
||||
}
|
||||
} else {
|
||||
@ -72,7 +76,7 @@ public class Player extends Character{
|
||||
}
|
||||
|
||||
|
||||
if(sm.isDoor(getPosition())){
|
||||
if(onDoor){
|
||||
String nMap = null;
|
||||
Integer x = null;
|
||||
Integer y = null;
|
||||
@ -86,7 +90,8 @@ public class Player extends Character{
|
||||
if (nMap == null || x == null || y == null) return;
|
||||
map = nMap;
|
||||
setPosition(x*sm.tileWidth, y*sm.tileHeight);
|
||||
System.out.println("Go to: " + sm.map + " in " + x + " x " + y);
|
||||
turn(goalDirection);
|
||||
System.out.println("Go to: " + map + " in " + x + " x " + y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user