Commit ff0221e7 authored by Theodore Lopez's avatar Theodore Lopez
parents c22a3c1e 461411a1
...@@ -327,7 +327,7 @@ R ...@@ -327,7 +327,7 @@ R
200 200
200 200
#entityDisplayerType #entityDisplayerType
FIREBOLT GOLD
#triggers #triggers
1 1
#trigger function #trigger function
......
...@@ -316,6 +316,40 @@ public class EntityDisplayerProvider { ...@@ -316,6 +316,40 @@ public class EntityDisplayerProvider {
} }
return new EntityDisplayer(associatedEntity, animationMapTab, 'C'); return new EntityDisplayer(associatedEntity, animationMapTab, 'C');
} }
case GOLD : {
Map<Action, Animation>[] animationMapTab= new Map[Direction.values().length] ;
animationMapTab[Direction.RIGHT.ordinal()] = new HashMap<Action, Animation>();
animationMapTab[Direction.RIGHTUP.ordinal()] = new HashMap<Action, Animation>();
animationMapTab[Direction.UP.ordinal()] = new HashMap<Action, Animation>();
animationMapTab[Direction.LEFTUP.ordinal()] = new HashMap<Action, Animation>();;
animationMapTab[Direction.LEFT.ordinal()] = new HashMap<Action, Animation>();
animationMapTab[Direction.LEFTDOWN.ordinal()] = new HashMap<Action, Animation>();;
animationMapTab[Direction.DOWN.ordinal()] = new HashMap<Action, Animation>();
animationMapTab[Direction.RIGHTDOWN.ordinal()] = new HashMap<Action, Animation>();
Sprite gold = SpriteStorage.getInstance().getGold();
for (Action action : Action.values()) {
Sprite persoR = new Sprite (gold.getSpriteImage(), 0, 0, 64, 32);
Animation persoAnimationRIGHT = new Animation(persoR, 2, frameDelay);
animationMapTab[Direction.RIGHT.ordinal()].put(action, persoAnimationRIGHT);
animationMapTab[Direction.RIGHTUP.ordinal()].put(action, persoAnimationRIGHT);
Sprite persoU = new Sprite (gold.getSpriteImage(), 0, 32, 64, 32);
Animation persoAnimationUP = new Animation(persoU, 2, frameDelay);
animationMapTab[Direction.UP.ordinal()].put(action, persoAnimationUP);
animationMapTab[Direction.LEFTUP.ordinal()].put(action, persoAnimationUP);
Sprite persoL = new Sprite (gold.getSpriteImage(), 0, 64, 64, 32);
Animation persoAnimationLEFT = new Animation(persoL, 2, frameDelay);
animationMapTab[Direction.LEFT.ordinal()].put(action, persoAnimationLEFT);
animationMapTab[Direction.LEFTDOWN.ordinal()].put(action, persoAnimationLEFT);
Sprite persoroseD = new Sprite (gold.getSpriteImage(), 0, 96, 64, 32);
Animation persoAnimationDOWN = new Animation(persoroseD, 2, frameDelay);
animationMapTab[Direction.DOWN.ordinal()].put(action, persoAnimationDOWN);
animationMapTab[Direction.RIGHTDOWN.ordinal()].put(action, persoAnimationDOWN);
}
return new EntityDisplayer(associatedEntity, animationMapTab, 'C');
}
default: { default: {
Map<Action, Animation>[] animationMapTab= new Map[Direction.values().length] ; Map<Action, Animation>[] animationMapTab= new Map[Direction.values().length] ;
animationMapTab[Direction.RIGHT.ordinal()] = new HashMap<Action, Animation>(); animationMapTab[Direction.RIGHT.ordinal()] = new HashMap<Action, Animation>();
......
...@@ -28,7 +28,7 @@ public class SpriteStorage { ...@@ -28,7 +28,7 @@ public class SpriteStorage {
diagla = new Sprite(ImageIO.read(UsedForLoadingSprites.getInstance().getClass().getResource("diagla.png"))); diagla = new Sprite(ImageIO.read(UsedForLoadingSprites.getInstance().getClass().getResource("diagla.png")));
firebolt = new Sprite(ImageIO.read(UsedForLoadingSprites.getInstance().getClass().getResource("firebolt.png"))); firebolt = new Sprite(ImageIO.read(UsedForLoadingSprites.getInstance().getClass().getResource("firebolt.png")));
frostbolt = new Sprite(ImageIO.read(UsedForLoadingSprites.getInstance().getClass().getResource("frostbolt.png"))); frostbolt = new Sprite(ImageIO.read(UsedForLoadingSprites.getInstance().getClass().getResource("frostbolt.png")));
gold = new Sprite(ImageIO.read(UsedForLoadingSprites.getInstance().getClass().getResource("GOLD.png"))); gold = new Sprite(ImageIO.read(UsedForLoadingSprites.getInstance().getClass().getResource("gold.png")));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -82,5 +82,6 @@ public class SpriteStorage { ...@@ -82,5 +82,6 @@ public class SpriteStorage {
} }
public Sprite getFrostbolt(){ public Sprite getFrostbolt(){
return frostbolt; return frostbolt;
} }
} }
...@@ -84,7 +84,19 @@ public class IGPEntity extends AbstractEntity { ...@@ -84,7 +84,19 @@ public class IGPEntity extends AbstractEntity {
} }
break; break;
case "soigner" : case "soigner" :
// This case is not implemented in the game, so "soigner" willl be considered as nothing by the IA // This case is not implemented in the game, so "soigner" will be considered as "follow" by the IA
System.out.println("Je suis" + victim.getName());
int dX4 = victim.getX();
int dY4 = victim.getY();
int sX4 = relayer.getCharacter().getX();
int sY4 = relayer.getCharacter().getY();
Direction dir4 = AI.alpha_star(map,sX4, sY4, dX4, dY4,map.getWidth(),map.getHeight());
if (relayer.getCharacter().getCollisionBox().intersect(victim.getCollisionBox())) {
this.relayer.move(Direction.NONE);
} else {
this.relayer.move(dir4);
}
break;
default: default:
// In the default case, so the aciton "nothing", the Follower will just follow his owner // In the default case, so the aciton "nothing", the Follower will just follow his owner
Entity owner =null; Entity owner =null;
...@@ -102,7 +114,7 @@ public class IGPEntity extends AbstractEntity { ...@@ -102,7 +114,7 @@ public class IGPEntity extends AbstractEntity {
this.relayer.move(Direction.NONE); this.relayer.move(Direction.NONE);
} else { } else {
this.relayer.move(dir3); this.relayer.move(dir3);
}this.relayer.move(dir3); }
} }
} }
} }
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