mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-11-04 13:19:17 +00:00 
			
		
		
		
	add xp and pv on display
This commit is contained in:
		@@ -29,6 +29,7 @@ public abstract class Character extends Entity{
 | 
			
		||||
    int nFrames = 4;
 | 
			
		||||
    final float FRAME_TIME = 0.1f; // Duration of each frime
 | 
			
		||||
    private String img;
 | 
			
		||||
    private String imgBattle;
 | 
			
		||||
 | 
			
		||||
    protected int pv;
 | 
			
		||||
 | 
			
		||||
@@ -43,6 +44,8 @@ public abstract class Character extends Entity{
 | 
			
		||||
    public Character(String name, int x, int y, String img, String map){
 | 
			
		||||
        super(name, x, y, map);
 | 
			
		||||
        this.img = img;
 | 
			
		||||
 | 
			
		||||
        imgBattle = "./Data/img/" + name + ".png";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -163,4 +166,8 @@ public abstract class Character extends Entity{
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    abstract protected void removedPv(int pv);
 | 
			
		||||
 | 
			
		||||
    public String getImgBattle(){
 | 
			
		||||
        return imgBattle;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,7 @@ public class Enemy extends Character{
 | 
			
		||||
 | 
			
		||||
    private String branch;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private int pvInit;
 | 
			
		||||
 | 
			
		||||
    public Enemy(String name, int x, int y, String img, String map, int pv, String branch, Character.Direction dir) {
 | 
			
		||||
 | 
			
		||||
@@ -21,6 +20,9 @@ public class Enemy extends Character{
 | 
			
		||||
        this.branch = branch;
 | 
			
		||||
 | 
			
		||||
        this.pv = pv;
 | 
			
		||||
 | 
			
		||||
        pvInit = pv;
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPosition(int x, int y, String map){
 | 
			
		||||
@@ -47,5 +49,10 @@ public class Enemy extends Character{
 | 
			
		||||
        //the pv can go under 0, but his real pv is 0 (for the player)
 | 
			
		||||
        return (pv<0) ? 0 : pv;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getPvInit(){
 | 
			
		||||
        return pvInit;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ public class Player extends Character{
 | 
			
		||||
    private int xp = 0;
 | 
			
		||||
	public Enemy lastEnemy = null;
 | 
			
		||||
	public boolean onEnemy = false;
 | 
			
		||||
	private static final int XP_MAX = 6000;
 | 
			
		||||
 | 
			
		||||
    public Player(int x, int y, String map) {
 | 
			
		||||
        super("Player", x, y, "Character_flipped", map);
 | 
			
		||||
@@ -119,4 +120,8 @@ public class Player extends Character{
 | 
			
		||||
        // TODO Auto-generated method stub
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getXpMax(){
 | 
			
		||||
		return XP_MAX;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user