1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2024-11-22 17:33:27 +00:00

add pokemon for enemy

This commit is contained in:
Rémi Heredero 2022-06-17 07:37:07 +02:00
parent bb02aa00f9
commit 3f0e963366
80 changed files with 50 additions and 66 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -21,13 +21,13 @@ public abstract class Character extends Entity{
* The currently selected sprite for animation
*/
int textureX = 0;
int textureY = 1;
int textureY = 0;
float speed = 1;
float dt = 0;
int currentFrame = 0;
int nFrames = 4;
final float FRAME_TIME = 0.1f; // Duration of each frime
final float FRAME_TIME = 0.1f; // Duration of each frame
private String img;
private String imgBattle;
@ -45,13 +45,13 @@ public abstract class Character extends Entity{
super(name, x, y, map);
this.img = img;
imgBattle = "./Data/img/" + name + ".png";
imgBattle = "./Data/img/person/" + name + ".png";
}
@Override
public void init() {
super.init();
ss = new Spritesheet("./Data/img/" + img + ".png", SPRITE_WIDTH, SPRITE_HEIGHT);
ss = new Spritesheet("./Data/img/sprite/" + img + ".png", SPRITE_WIDTH, SPRITE_HEIGHT);
}
@Override
@ -140,10 +140,10 @@ public abstract class Character extends Entity{
textureY = 2;
break;
case LEFT:
textureY = 3;
textureY = 1;
break;
case UP:
textureY = 1;
textureY = 3;
break;
case DOWN:
textureY = 0;

View File

@ -11,15 +11,13 @@ public class Enemy extends Character{
private int pvInit;
public Enemy(String name, int x, int y, String img, String map, int pv, String branch, Character.Direction dir) {
public Enemy(String name, int x, int y, String map, int pv, String branch) {
super(name, x, y, img, map);
super(name, x, y, branch, map);
//generate his text
this.map = map;
turn(dir);
this.branch = branch;
this.pv = pv;

View File

@ -19,7 +19,7 @@ public class Player extends Character{
private static final int XP_MAX = 6000;
public Player(int x, int y, String map) {
super("Player", x, y, "Character_flipped", map);
super("Player", x, y, "sprite_sacha", map); //Character_flipped
this.pv = Settings.TIME*60;
}
@ -70,7 +70,7 @@ public class Player extends Character{
turn(goalDirection);
System.out.println("It's a enemy !!");
} else {
setSpeed(sm.getSpeed(nextCell)); //TODO remove x3
setSpeed(sm.getSpeed(nextCell)*1.5f);
go(goalDirection);
}
} else {
@ -81,7 +81,7 @@ public class Player extends Character{
if(onDoor){
long time = System.currentTimeMillis();
while (System.currentTimeMillis()-time < Settings.SWITCHMAPTIME) { }
while (System.currentTimeMillis()-time < Settings.SWITCH_MAP_TIME) { }
String nMap = null;
Integer x = null;
Integer y = null;
@ -94,7 +94,7 @@ public class Player extends Character{
ScreenMap.Door.reset();
if (nMap == null || x == null || y == null) return;
map = nMap;
if(map.equals("FabLab")) addXp(400); // * Like an easter egg, but necessary for win the game
if(map.equals("FabLab")) addXp(400); // * Like an Easter egg, but necessary for win the game
setPosition(x*sm.tileWidth, y*sm.tileHeight);
turn(goalDirection);
System.out.println("Go to: " + map + " in " + x + " x " + y);

View File

@ -76,10 +76,10 @@ public class Battle {
String answerPlayer = textEnemy.fightData.getAttack(currentAttack).getAnswer(currentAnswer);
//get true answer
String trueAsnwer = textEnemy.fightData.getAttack(currentAttack).getTrueAnswer();
String trueAnswer = textEnemy.fightData.getAttack(currentAttack).getTrueAnswer();
//check the choice of the player
if(answerPlayer == trueAsnwer){
if(answerPlayer == trueAnswer){
newXp += textEnemy.fightData.getAttack(currentAttack).getXp();
updatePlayerEnemy(textEnemy.fightData.getAttack(currentAttack).getXp());
System.out.println("it's true !!!!");
@ -102,12 +102,12 @@ public class Battle {
public void FinishSpeech(){
if(pvEnemy>0){
//alive (speechline = 6)
//alive (speechLine = 6)
lineSpeech = 6;
System.out.println("enemy alive");
}
else{
//dead (speechline = 5)
//dead (speechLine = 5)
lineSpeech = 5;
System.out.println("enemy dead");
}

View File

@ -3,7 +3,6 @@ package Main;
import java.util.Vector;
import Control.Controller;
import Entity.Character.Direction;
import Entity.Enemy;
import Entity.Entity;
import Game.Battle;
@ -47,12 +46,12 @@ public class PokeMudry extends PortableApplication {
// add player, create and add all enemies in entities
entities.add((Entity) sp.p);
enemies.add(new Enemy("Gloeckner", 1, 7, "lumberjack_sheet32", "21N307", 600, "allemand", Direction.RIGHT));
enemies.add(new Enemy("Nicollier", 4, 2, "lumberjack_sheet32", "21N308", 1600, "mathematique", Direction.LEFT));
enemies.add(new Enemy("Mudry", 5, 11, "lumberjack_sheet32", "21N304", 700, "informatique", Direction.DOWN));
enemies.add(new Enemy("Ellert", 1, 4, "lumberjack_sheet32", "23N215", 300, "physique", Direction.RIGHT));
enemies.add(new Enemy("Bianchi", 1, 3, "lumberjack_sheet32", "23N308", 1200, "electricite", Direction.RIGHT));
enemies.add(new Enemy("Paciotti", 5, 11, "lumberjack_sheet32", "21N205", 1200, "mecanique", Direction.DOWN));
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 = 10; // 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 SWITCHMAPTIME = 250; // Number of milliseconds the player wait for switch map
public static final int SWITCH_MAP_TIME = 250; // Number of milliseconds the player wait for switch map
public static final int SIDE = 800;

View File

@ -23,8 +23,8 @@ public class ScreenBattle extends RenderingScreen{
private static int HEIGHT_DIALOG = Settings.SIDE / 3;
private static int WIDTH_DIALOG = Settings.SIDE - 2*EDGE;
private BitmapFont unbuntuRegularBlack;
private BitmapFont unbuntuRegularWhite;
private BitmapFont ubuntuRegularBlack;
private BitmapFont ubuntuRegularWhite;
private BitmapImage enemyImg;
private BitmapImage playerImg;
@ -34,8 +34,8 @@ public class ScreenBattle extends RenderingScreen{
@Override
public void onInit() {
//display the question
unbuntuRegularBlack = generateFont("./Data/font/Ubuntu-Regular.ttf", 30, Color.BLACK);
unbuntuRegularWhite = generateFont("./Data/font/Ubuntu-Regular.ttf", 45, Color.WHITE);
ubuntuRegularBlack = generateFont("./Data/font/Ubuntu-Regular.ttf", 30, Color.BLACK);
ubuntuRegularWhite = generateFont("./Data/font/Ubuntu-Regular.ttf", 45, Color.WHITE);
}
@ -49,8 +49,8 @@ public class ScreenBattle extends RenderingScreen{
@Override
public void dispose() {
unbuntuRegularBlack.dispose();
unbuntuRegularWhite.dispose();
ubuntuRegularBlack.dispose();
ubuntuRegularWhite.dispose();
}
public void setImg(){
@ -84,7 +84,7 @@ public class ScreenBattle extends RenderingScreen{
//dialog
if(b == null) return;
if(b.getLine() == null) return;
g.drawString(15, 260, b.getLine(), unbuntuRegularBlack);
g.drawString(15, 260, b.getLine(), ubuntuRegularBlack);
}
@ -93,7 +93,7 @@ public class ScreenBattle extends RenderingScreen{
//draw image
g.drawPicture(Settings.SIDE - (192/2), Settings.SIDE-240/2, enemyImg);
//draw pv
g.drawString(300, Settings.SIDE - 15 , "PV : " + b.pvEnemy + " / " + b.e.getPvInit(), unbuntuRegularWhite);
g.drawString(300, Settings.SIDE - 15 , "PV : " + b.pvEnemy + " / " + b.e.getPvInit(), ubuntuRegularWhite);
}
@ -103,7 +103,7 @@ public class ScreenBattle extends RenderingScreen{
g.drawPicture((192/2), HEIGHT_DIALOG + 10 + 240/2, playerImg);
//draw pv
g.drawString(255, HEIGHT_DIALOG + 100 , "XP : " + b.xpPlayer + " / " + b.player.getXpMax() + "\nPV : " + b.player.getPv() + " / " + Settings.TIME*60, unbuntuRegularWhite);
g.drawString(255, HEIGHT_DIALOG + 100 , "XP : " + b.xpPlayer + " / " + b.player.getXpMax() + "\nPV : " + b.player.getPv() + " / " + Settings.TIME*60, ubuntuRegularWhite);
}

View File

@ -2,7 +2,6 @@ package Screen;
import Entity.Enemy;
import Entity.Player;
import Entity.Character.Direction;
import Game.Battle;
import ch.hevs.gdx2d.lib.GdxGraphics;
@ -21,7 +20,7 @@ public class ScreenPlayer {
//p = new Player(8, 15, "desert");
p = new Player(4, 2, "21RI");
e = new Enemy("enemy", 0, 0, "lumberjack_sheet32", "desert", 50, "enemy",Direction.NULL);
e = new Enemy("enemy", 0, 0, "desert", 50, "enemy");
b = new Battle(e);
// Create both type of screen and record for reuse

View File

@ -14,7 +14,7 @@ public class FightData {
public int nbre_line =0;
public int nbr_line =0;
public FightData(String branch) {
file = new File("./Data/Battle/Fight/" + branch + ".csv");
@ -37,7 +37,7 @@ public class FightData {
attacks.add(attack);
line = bf.readLine();
//add line
nbre_line++;
nbr_line++;
}
bf.close();

View File

@ -1,8 +1,6 @@
package Text;
import Entity.Enemy;
import Entity.Character.Direction;
import java.util.Vector;
import java.util.Arrays;
import java.util.Random;
@ -18,16 +16,6 @@ public class TextEnemy {
private int[] orderAnswer;
private Vector<int[]> currentData;
public static void main(String[] args) {
TextEnemy t = new TextEnemy(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique", Direction.NULL));
t.generateText();
for(Line l : t.lines) {
System.out.println(l.line);
}
}
public TextEnemy(Enemy e){
//generate the vector of fight
@ -38,12 +26,12 @@ public class TextEnemy {
speechData = new SpeechData(e.getName());
speechData.readFile();
//save random data (attack and ansver) : attack, answer 1, answer 2 answer 3, answer 4
//save random data (attack and answer) : attack, answer 1, answer 2 answer 3, answer 4
currentData = new Vector<int[]>();
}
public static int[] randomGenerate( int min, int max, int nbreRandom){
public static int[] randomGenerate( int min, int max, int nbrRandom){
//create an array with all the number I need
int[] a = new int[max-min+1];
int k = min;
@ -53,7 +41,7 @@ public class TextEnemy {
}
//create a new array with the numbers I want
int[] b = new int[nbreRandom];
int[] b = new int[nbrRandom];
// Creating object for Random class
Random rd = new Random();
@ -70,7 +58,7 @@ public class TextEnemy {
a[j] = temp;
}
//add the numbers I want
for(int i=0;i<nbreRandom;i++){
for(int i=0;i<nbrRandom;i++){
b[i] = a[i];
}
return b;
@ -86,7 +74,7 @@ public class TextEnemy {
lines.add(new Line(introduction, false));
orderAttack = randomGenerate(0, fightData.nbre_line-1, 4);
orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
for(int j=0; j<4;j++){
int[] currentRandom = new int[5];
currentRandom[0] = orderAttack[j];
@ -135,7 +123,7 @@ public class TextEnemy {
String newLine = "";
int startC = 0;
int stoppC = cut;
int stopC = cut;
if(cut>line.length()-1){
newLine =line;
@ -151,35 +139,35 @@ public class TextEnemy {
while(true){
for(int i =stoppC; i>=startC; i--){
for(int i =stopC; i>=startC; i--){
if(c[i] == ' '){
stoppC = i;
stopC = i;
break;
}
else if(stoppC == c.length-1){
else if(stopC == c.length-1){
break;
}
}
//découper le mot
for(int i=startC;i<=stoppC;i++){
for(int i=startC;i<=stopC;i++){
cutLine += c[i];
}
newLine += cutLine+"\n";
cutLine = "";
startC = stoppC + 1;
startC = stopC + 1;
if(c.length-1-stoppC <=0){
if(c.length-1-stopC <=0){
break;
}
else if(c.length-1-stoppC <= cut){
stoppC = c.length-1;
else if(c.length-1-stopC <= cut){
stopC = c.length-1;
}
else{
stoppC += cut;
stopC += cut;
}
}
}