1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2024-11-23 01:43:28 +00:00

Merge pull request #33 from Klagarge:add-enemies

finish to add enemy
This commit is contained in:
Rémi Heredero 2022-06-15 16:50:38 +02:00 committed by GitHub
commit fee27ebbab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 11 deletions

View File

@ -8,13 +8,13 @@ public class Enemy extends Character{
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;

View File

@ -7,6 +7,7 @@ import com.badlogic.gdx.Input;
import Control.Controller;
import Entity.Enemy;
import Entity.Entity;
import Entity.Character.Direction;
import Game.Battle;
import Screen.ScreenBattle;
import Screen.ScreenMap;
@ -45,8 +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("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique"));
enemies.add(new Enemy("Mudry", 5, 11, "lumberjack_sheet32", "21N304", 25, "informatique"));
enemies.add(new Enemy("Mudry", 5, 11, "lumberjack_sheet32", "21N304", 25, "informatique", Direction.DOWN));
enemies.add(new Enemy("Paciotti", 5, 11, "lumberjack_sheet32", "21N205", 0, "mecanique", Direction.DOWN));
enemies.add(new Enemy("Gloeckner", 1, 7, "lumberjack_sheet32", "21N307", 0, "allemand", Direction.RIGHT));
enemies.add(new Enemy("Bianchi", 1, 3, "lumberjack_sheet32", "23N308", 0, "electricite", Direction.RIGHT));
enemies.add(new Enemy("Nicollier", 4, 2, "lumberjack_sheet32", "21N308", 0, "mathematique", Direction.LEFT));
enemies.add(new Enemy("Ellert", 1, 4, "lumberjack_sheet32", "23N215", 0, "physique", Direction.RIGHT));
for (Enemy enemy : enemies) { entities.add(enemy); }
@ -65,11 +70,15 @@ public class PokeMudry extends PortableApplication {
// Switch screen
if (sp.p.onEnemy && onMapScreen){
sp.e = sp.p.lastEnemy;
sp.sb = sp.screenManager.getScreenBattle();
if(sp.e == null) System.out.println("sdfsdfsdfsdf");
sp.b = new Battle(sp.e);
g.resetCamera();
int pv = sp.e.getPv();
if (pv>0) {
sp.sb = sp.screenManager.getScreenBattle();
sp.b = new Battle(sp.e);
g.resetCamera();
} else {
sp.p.onEnemy = false;
}
}
if(onBattleScreen) sp.sb.manage(controller, sp.b);

View File

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

View File

@ -3,6 +3,7 @@ package Text;
import java.util.Vector;
import Entity.Enemy;
import Entity.Character.Direction;
import java.util.Arrays;
import java.util.Random;
@ -20,7 +21,7 @@ public class TextEnemy {
public static void main(String[] args) {
TextEnemy t = new TextEnemy(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique"));
TextEnemy t = new TextEnemy(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique",Direction.NULL));
t.generateText();