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

Merge pull request #46 from Klagarge/add-FabLab

Add-FabLab
This commit is contained in:
Rémi Heredero 2022-06-17 08:57:02 +02:00 committed by GitHub
commit b67798adb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
89 changed files with 203 additions and 77 deletions

View File

@ -1,4 +1,4 @@
Quelle est l'équation de la position en fonction du temps ?;x(t) = (1/2)at^2 + vt + x;x(t) = vt + x;v(t) = at + v;x(t) = at^2 + vt + x;100 Quelle est l'équation de la position en fonction du temps ?;x(t) = (1/2)at^2 + vt + x;x(t) = vt + x;v(t) = at + v;x(t) = at^2 + vt + x;100
Comment appelle-t-on la constante dans la formule pour calculer la force de d'attraction ?;la constante de gravitation;la constante de gravité;G = 5.674184;elle est valable dans tout l'univers ;50 Comment appelle-t-on la constante dans la formule pour calculer la force d'attraction ?;la constante de gravitation;la constante de gravité;G = 5.674184;elle est valable dans tout l'univers ;50
Quelle est la valeur de la constante de gravitation ?;G = 6.674184;G = 5.674184;G = 0.674184;G = 10 (dans notre univers);75 Quelle est la valeur de la constante de gravitation ?;G = 6.674184;G = 5.674184;G = 0.674184;G = 10 (dans notre univers);75
Quelle est l'équation de la quantité de mouvement ?;P = m*v;A = t*a;S = u/r;H = k^2-f;75 Quelle est l'équation de la quantité de mouvement ?;P = m*v;A = t*a;S = u/r;H = k^2-f;75

1 Quelle est l'équation de la position en fonction du temps ? x(t) = (1/2)at^2 + vt + x x(t) = vt + x v(t) = at + v x(t) = at^2 + vt + x 100
2 Comment appelle-t-on la constante dans la formule pour calculer la force de d'attraction ? Comment appelle-t-on la constante dans la formule pour calculer la force d'attraction ? la constante de gravitation la constante de gravité G = 5.674184 elle est valable dans tout l'univers 50
3 Quelle est la valeur de la constante de gravitation ? G = 6.674184 G = 5.674184 G = 0.674184 G = 10 (dans notre univers) 75
4 Quelle est l'équation de la quantité de mouvement ? P = m*v A = t*a S = u/r H = k^2-f 75

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.8" tiledversion="1.8.5" orientation="orthogonal" renderorder="right-down" width="30" height="24" tilewidth="32" tileheight="32" infinite="0" nextlayerid="7" nextobjectid="5"> <map version="1.8" tiledversion="1.8.5" orientation="orthogonal" renderorder="right-down" width="30" height="24" tilewidth="32" tileheight="32" infinite="0" nextlayerid="7" nextobjectid="6">
<tileset firstgid="1" source="assets/Dungeon_v2.tsx"/> <tileset firstgid="1" source="assets/Dungeon_v2.tsx"/>
<tileset firstgid="229" source="assets/pokemon_v2.tsx"/> <tileset firstgid="229" source="assets/pokemon_v2.tsx"/>
<layer id="1" name="floor" width="30" height="24"> <layer id="1" name="floor" width="30" height="24">
@ -103,5 +103,13 @@
<property name="nextY" type="int" value="8"/> <property name="nextY" type="int" value="8"/>
</properties> </properties>
</object> </object>
<object id="5" x="946.667" y="432">
<properties>
<property name="nextDirection" value="RIGHT"/>
<property name="nextMap" value="FabLab"/>
<property name="nextX" type="int" value="1"/>
<property name="nextY" type="int" value="10"/>
</properties>
</object>
</objectgroup> </objectgroup>
</map> </map>

70
Data/map/FabLab.tmx Normal file
View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.8" tiledversion="1.8.5" orientation="orthogonal" renderorder="right-down" width="27" height="14" tilewidth="32" tileheight="32" infinite="0" nextlayerid="9" nextobjectid="5">
<tileset firstgid="1" source="assets/Dungeon_v2.tsx"/>
<tileset firstgid="229" source="assets/pokemon_v2.tsx"/>
<tileset firstgid="1215" source="assets/Slates_v2.tsx"/>
<layer id="1" name="floor" width="27" height="14">
<data encoding="csv">
77,77,77,77,77,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
77,77,77,77,77,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
77,77,77,77,77,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
77,77,77,77,77,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
77,77,77,77,77,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
77,77,77,77,77,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
21,21,21,21,21,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
21,21,21,21,21,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
21,21,21,21,21,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
21,21,21,21,21,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
21,21,21,21,21,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
21,21,21,21,21,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
21,21,21,21,21,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,
21,21,21,21,21,523,523,523,523,523,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228,1228
</data>
</layer>
<layer id="8" name="small wall" width="27" height="14">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,2147484531,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,814,0,0,0,0,0,0,
0,0,0,0,0,2147484531,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,814,0,0,0,0,0,0,
0,0,0,0,0,2147484462,0,0,0,0,2147484462,0,0,0,0,0,0,0,0,2147484462,814,0,0,0,0,0,0,
0,0,0,0,0,2147484531,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,814,0,0,0,0,0,0,
0,0,0,0,0,2147484531,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,814,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0,0,2147484531,0,0,0,0,0,0,0
</data>
</layer>
<layer id="4" name="wall" width="27" height="14">
<data encoding="csv">
4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,
23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,
22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
42,43,43,43,43,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
61,62,62,62,62,221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
45,0,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
45,0,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
45,0,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
45,45,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
45,45,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,
45,45,0,0,0,22,0,0,0,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,20,
45,45,0,0,0,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,44,
45,0,0,0,0,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,63
</data>
</layer>
<objectgroup id="5" name="door">
<object id="4" name="RS" x="16.6667" y="111.333">
<properties>
<property name="nextDirection" value="LEFT"/>
<property name="nextMap" value="23RS"/>
<property name="nextX" type="int" value="28"/>
<property name="nextY" type="int" value="10"/>
</properties>
</object>
</objectgroup>
</map>

BIN
PokeMudry.jar Normal file

Binary file not shown.

View File

@ -5,6 +5,12 @@ import java.util.TreeMap;
import com.badlogic.gdx.Input; import com.badlogic.gdx.Input;
/**
* Store key status for control the game
* @author Rémi Heredero
* @author Yann Sierro
* @version 1.0.0
*/
public class Controller { public class Controller {
public Map<Integer, Boolean> keyStatus = new TreeMap<Integer, Boolean>(); public Map<Integer, Boolean> keyStatus = new TreeMap<Integer, Boolean>();

View File

@ -2,6 +2,12 @@ package Control;
import Screen.ScreenPlayer; import Screen.ScreenPlayer;
/**
* Manage input from keyboard for write on controller
* @author Rémi Heredero
* @author Yann Sierro
* @version 1.0.0
*/
public class Keyboard { public class Keyboard {
public void keyDown(int keycode, ScreenPlayer sp, Controller c) { public void keyDown(int keycode, ScreenPlayer sp, Controller c) {
c.keyStatus.put(keycode, true); c.keyStatus.put(keycode, true);

View File

@ -7,8 +7,15 @@ import com.badlogic.gdx.math.Vector2;
import ch.hevs.gdx2d.components.bitmaps.Spritesheet; import ch.hevs.gdx2d.components.bitmaps.Spritesheet;
import ch.hevs.gdx2d.lib.GdxGraphics; import ch.hevs.gdx2d.lib.GdxGraphics;
/**
* Class for manage all type of character. Player, enemy and why not some npc
* @author Rémi Heredero
* @author Yann Sierro
* @version 1.0.0
*/
public abstract class Character extends Entity{ public abstract class Character extends Entity{
// Each character have a direction for orientation and where it will go
public enum Direction{ public enum Direction{
UP, UP,
DOWN, DOWN,
@ -21,13 +28,13 @@ public abstract class Character extends Entity{
* The currently selected sprite for animation * The currently selected sprite for animation
*/ */
int textureX = 0; int textureX = 0;
int textureY = 1; int textureY = 0;
float speed = 1; float speed = 1;
float dt = 0; float dt = 0;
int currentFrame = 0; int currentFrame = 0;
int nFrames = 4; 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 img;
private String imgBattle; private String imgBattle;
@ -45,13 +52,13 @@ public abstract class Character extends Entity{
super(name, x, y, map); super(name, x, y, map);
this.img = img; this.img = img;
imgBattle = "./Data/img/" + name + ".png"; imgBattle = "./Data/img/person/" + name + ".png";
} }
@Override @Override
public void init() { public void init() {
super.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 @Override
@ -140,10 +147,10 @@ public abstract class Character extends Entity{
textureY = 2; textureY = 2;
break; break;
case LEFT: case LEFT:
textureY = 3; textureY = 1;
break; break;
case UP: case UP:
textureY = 1; textureY = 3;
break; break;
case DOWN: case DOWN:
textureY = 0; textureY = 0;

View File

@ -6,21 +6,28 @@ import Main.Settings;
public class Enemy extends Character{ public class Enemy extends Character{
private String branch; private String subject;
public int recoveredTime = Settings.RECOVERED; public int recoveredTime = Settings.RECOVERED;
private int pvInit; private int pvInit;
public Enemy(String name, int x, int y, String img, String map, int pv, String branch, Character.Direction dir) { /**
* Create an enemy
* @param name The name of this enemy
* @param x Initial x position
* @param y Initial y position
* @param map Initial map for this enemy
* @param pv Maximum pv of this enemy (it's also the maximum of XP the player can win)
* @param subject The subject taught by the enemy
*/
public Enemy(String name, int x, int y, String map, int pv, String subject) {
super(name, x, y, img, map); super(name, x, y, subject, map);
//generate his text //generate his text
this.map = map; this.map = map;
turn(dir); this.subject = subject;
this.branch = branch;
this.pv = pv; this.pv = pv;
@ -44,7 +51,7 @@ public class Enemy extends Character{
} }
public String getBranch(){ public String getBranch(){
return branch; return subject;
} }
@Override @Override

View File

@ -6,6 +6,13 @@ import ch.hevs.gdx2d.components.bitmaps.Spritesheet;
import ch.hevs.gdx2d.lib.GdxGraphics; import ch.hevs.gdx2d.lib.GdxGraphics;
import ch.hevs.gdx2d.lib.interfaces.DrawableObject; import ch.hevs.gdx2d.lib.interfaces.DrawableObject;
/**
* Main class for manage entity
* Can create all type of entity character or just stuff.
* @author Rémi Heredero
* @author Yann Sierro
* @version 1.0.0
*/
public abstract class Entity implements DrawableObject { public abstract class Entity implements DrawableObject {
protected String name; protected String name;
protected String map; protected String map;
@ -51,7 +58,6 @@ public abstract class Entity implements DrawableObject {
} }
public void graphicRender(GdxGraphics g){ public void graphicRender(GdxGraphics g){
} }
/** /**

View File

@ -18,8 +18,14 @@ public class Player extends Character{
public boolean onEnemy = false; public boolean onEnemy = false;
private static final int XP_MAX = 6000; private static final int XP_MAX = 6000;
public Player(int x, int y, String map) { /**
super("Player", x, y, "Character_flipped", map); * Create a player
* @param x initial x position
* @param y initial y position
* @param map initial map
*/
public Player(int x, int y, String map) {
super("Player", x, y, "sprite_sacha", map);
this.pv = Settings.TIME*60; this.pv = Settings.TIME*60;
} }
@ -31,7 +37,12 @@ public class Player extends Character{
return xp; return xp;
} }
public void manageEntity(ScreenMap sm, Controller c) { /**
* All action for manage the Player
* @param sm the screenMap where is the player
* @param c the controller of this player
*/
public void manageEntity(ScreenMap sm, Controller c) {
boolean onDoor = sm.isDoor(getPosition()); boolean onDoor = sm.isDoor(getPosition());
@ -70,7 +81,7 @@ public class Player extends Character{
turn(goalDirection); turn(goalDirection);
System.out.println("It's a enemy !!"); System.out.println("It's a enemy !!");
} else { } else {
setSpeed(sm.getSpeed(nextCell)*3); //TODO remove x3 setSpeed(sm.getSpeed(nextCell)*1.5f);
go(goalDirection); go(goalDirection);
} }
} else { } else {
@ -81,7 +92,7 @@ public class Player extends Character{
if(onDoor){ if(onDoor){
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
while (System.currentTimeMillis()-time < Settings.SWITCHMAPTIME) { } while (System.currentTimeMillis()-time < Settings.SWITCH_MAP_TIME) { }
String nMap = null; String nMap = null;
Integer x = null; Integer x = null;
Integer y = null; Integer y = null;
@ -94,6 +105,7 @@ public class Player extends Character{
ScreenMap.Door.reset(); ScreenMap.Door.reset();
if (nMap == null || x == null || y == null) return; if (nMap == null || x == null || y == null) return;
map = nMap; map = nMap;
if(map.equals("FabLab")) addXp(400); // * Like an Easter egg, but necessary for win the game
setPosition(x*sm.tileWidth, y*sm.tileHeight); setPosition(x*sm.tileWidth, y*sm.tileHeight);
turn(goalDirection); turn(goalDirection);
System.out.println("Go to: " + map + " in " + x + " x " + y); System.out.println("Go to: " + map + " in " + x + " x " + y);
@ -101,7 +113,13 @@ public class Player extends Character{
} }
} }
private boolean enemy(ScreenMap sm, Vector2 nextPos) { /**
* Return true if an enemy is on next position
* @param sm Screen map where is the player
* @param nextPos Vector of next position
* @return true if an enemy is on next position
*/
private boolean enemy(ScreenMap sm, Vector2 nextPos) {
Vector<Enemy> enemies = PokeMudry.getEnemies(); Vector<Enemy> enemies = PokeMudry.getEnemies();
for (Enemy enemy : enemies) { for (Enemy enemy : enemies) {
boolean bMap = sm.map.equals(enemy.getMap()); boolean bMap = sm.map.equals(enemy.getMap());

View File

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

View File

@ -3,7 +3,6 @@ package Main;
import java.util.Vector; import java.util.Vector;
import Control.Controller; import Control.Controller;
import Entity.Character.Direction;
import Entity.Enemy; import Entity.Enemy;
import Entity.Entity; import Entity.Entity;
import Game.Battle; import Game.Battle;
@ -47,12 +46,12 @@ public class PokeMudry extends PortableApplication {
// add player, create and add all enemies in entities // add player, create and add all enemies in entities
entities.add((Entity) sp.p); entities.add((Entity) sp.p);
enemies.add(new Enemy("Gloeckner", 1, 7, "lumberjack_sheet32", "21N307", 600, "allemand", Direction.RIGHT)); enemies.add(new Enemy("Gloeckner", 1, 7, "21N307", 600, "allemand"));
enemies.add(new Enemy("Nicollier", 4, 2, "lumberjack_sheet32", "21N308", 1600, "mathematique", Direction.LEFT)); enemies.add(new Enemy("Nicollier", 4, 2, "21N308", 1600, "mathematique"));
enemies.add(new Enemy("Mudry", 5, 11, "lumberjack_sheet32", "21N304", 700, "informatique", Direction.DOWN)); enemies.add(new Enemy("Mudry", 5, 11, "21N304", 700, "informatique"));
enemies.add(new Enemy("Ellert", 1, 4, "lumberjack_sheet32", "23N215", 300, "physique", Direction.RIGHT)); enemies.add(new Enemy("Ellert", 1, 4, "23N215", 300, "physique"));
enemies.add(new Enemy("Bianchi", 1, 3, "lumberjack_sheet32", "23N308", 1200, "electricite", Direction.RIGHT)); enemies.add(new Enemy("Bianchi", 1, 3, "23N308", 1200, "electricite"));
enemies.add(new Enemy("Paciotti", 5, 11, "lumberjack_sheet32", "21N205", 1200, "mecanique", Direction.DOWN)); enemies.add(new Enemy("Paciotti", 5, 11, "21N205", 1200, "mecanique"));
for (Enemy enemy : enemies) { entities.add(enemy); } for (Enemy enemy : enemies) { entities.add(enemy); }
//Init all entities //Init all entities

View File

@ -4,9 +4,9 @@ public class Settings {
public static final boolean ANDROID = false; public static final boolean ANDROID = false;
public static final int PLAYERS = 1; 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 TIME = 15; // 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 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; 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 HEIGHT_DIALOG = Settings.SIDE / 3;
private static int WIDTH_DIALOG = Settings.SIDE - 2*EDGE; private static int WIDTH_DIALOG = Settings.SIDE - 2*EDGE;
private BitmapFont unbuntuRegularBlack; private BitmapFont ubuntuRegularBlack;
private BitmapFont unbuntuRegularWhite; private BitmapFont ubuntuRegularWhite;
private BitmapImage enemyImg; private BitmapImage enemyImg;
private BitmapImage playerImg; private BitmapImage playerImg;
@ -33,9 +33,9 @@ public class ScreenBattle extends RenderingScreen{
@Override @Override
public void onInit() { public void onInit() {
//generate the fonts //display the question
unbuntuRegularBlack = generateFont("./Data/font/Ubuntu-Regular.ttf", 30, Color.BLACK); ubuntuRegularBlack = generateFont("./Data/font/Ubuntu-Regular.ttf", 30, Color.BLACK);
unbuntuRegularWhite = generateFont("./Data/font/Ubuntu-Regular.ttf", 45, Color.WHITE); ubuntuRegularWhite = generateFont("./Data/font/Ubuntu-Regular.ttf", 45, Color.WHITE);
} }
@ -51,8 +51,8 @@ public class ScreenBattle extends RenderingScreen{
@Override @Override
public void dispose() { public void dispose() {
unbuntuRegularBlack.dispose(); ubuntuRegularBlack.dispose();
unbuntuRegularWhite.dispose(); ubuntuRegularWhite.dispose();
} }
//set the images for the player and the enemy //set the images for the player and the enemy
@ -87,21 +87,23 @@ public class ScreenBattle extends RenderingScreen{
//draw the dialog //draw the dialog
if(b == null) return; if(b == null) return;
if(b.getLine() == null) return; if(b.getLine() == null) return;
g.drawString(15, 260, b.getLine(), unbuntuRegularBlack); g.drawString(15, 260, b.getLine(), ubuntuRegularBlack);
} }
public void displayEnemy(GdxGraphics g){ public void displayEnemy(GdxGraphics g){
//draw image //draw image
g.drawPicture(Settings.SIDE - (192/2), Settings.SIDE-240/2, enemyImg); g.drawPicture(Settings.SIDE - (192/2), Settings.SIDE-240/2, enemyImg);
//draw pv //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);
} }
public void displayPlayer(GdxGraphics g){ public void displayPlayer(GdxGraphics g){
//draw image //draw image
g.drawPicture((192/2), HEIGHT_DIALOG + 10 + 240/2, playerImg); g.drawPicture((192/2), HEIGHT_DIALOG + 10 + 240/2, playerImg);
//draw pv and xp //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);
} }
public void manage(Controller c, Battle battle){ public void manage(Controller c, Battle battle){

View File

@ -9,7 +9,6 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFont
import Entity.Player; import Entity.Player;
import Main.Settings; import Main.Settings;
import ch.hevs.gdx2d.components.screen_management.RenderingScreen; import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
import ch.hevs.gdx2d.lib.GdxGraphics; import ch.hevs.gdx2d.lib.GdxGraphics;

View File

@ -68,6 +68,7 @@ public class ScreenMap extends RenderingScreen{
createMap("23RI"); createMap("23RI");
createMap("23RS"); createMap("23RS");
createMap("FabLab");
createMap("23N1"); createMap("23N1");
createMap("23N2"); createMap("23N2");
createMap("23N215"); createMap("23N215");

View File

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

View File

@ -34,7 +34,7 @@ public class FightData {
attacks.add(attack); attacks.add(attack);
line = bf.readLine(); line = bf.readLine();
//add line //add line
nbre_line++; nbr_line++;
} }
bf.close(); bf.close();

View File

@ -1,12 +1,12 @@
package Text; package Text;
import Entity.Enemy; import Entity.Enemy;
import java.util.Vector; import java.util.Vector;
import java.util.Arrays;
import java.util.Random; import java.util.Random;
public class TextEnemy { public class TextEnemy {
private static final int CUT = 60; private static final int CUT = 55;
public FightData fightData; public FightData fightData;
public SpeechData speechData; public SpeechData speechData;
@ -26,13 +26,12 @@ public class TextEnemy {
speechData = new SpeechData(e.getName()); speechData = new SpeechData(e.getName());
speechData.readFile(); 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[]>(); currentData = new Vector<int[]>();
} }
//generate a random array width different number public static int[] randomGenerate( int min, int max, int nbrRandom){
public static int[] randomGenerate( int min, int max, int nbreRandom){
//create an array with all the number I need //create an array with all the number I need
int[] a = new int[max-min+1]; int[] a = new int[max-min+1];
int k = min; int k = min;
@ -42,7 +41,7 @@ public class TextEnemy {
} }
//create a new array with the numbers I want //create a new array with the numbers I want
int[] b = new int[nbreRandom]; int[] b = new int[nbrRandom];
// Creating object for Random class // Creating object for Random class
Random rd = new Random(); Random rd = new Random();
@ -59,7 +58,7 @@ public class TextEnemy {
a[j] = temp; a[j] = temp;
} }
//add the numbers I want //add the numbers I want
for(int i=0;i<nbreRandom;i++){ for(int i=0;i<nbrRandom;i++){
b[i] = a[i]; b[i] = a[i];
} }
return b; return b;
@ -74,10 +73,8 @@ public class TextEnemy {
String introduction = formatLine(speechData.getSpeechs(0), CUT); String introduction = formatLine(speechData.getSpeechs(0), CUT);
lines.add(new Line(introduction, false)); lines.add(new Line(introduction, false));
//generate a random array for determin the order of the attack orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
orderAttack = randomGenerate(0, fightData.nbre_line-1, 4);
//go trough which attack
for(int j=0; j<4;j++){ for(int j=0; j<4;j++){
int[] currentRandom = new int[5]; int[] currentRandom = new int[5];
currentRandom[0] = orderAttack[j]; currentRandom[0] = orderAttack[j];
@ -129,7 +126,7 @@ public class TextEnemy {
String newLine = ""; String newLine = "";
int startC = 0; int startC = 0;
int stoppC = cut; int stopC = cut;
//check if the line is shorter than the character limit //check if the line is shorter than the character limit
if(cut>line.length()-1){ if(cut>line.length()-1){
@ -144,19 +141,20 @@ public class TextEnemy {
} }
while(true){ while(true){
//cut the line only if there is a space for(int i =stopC; i>=startC; i--){
for(int i =stoppC; i>=startC; i--){
if(c[i] == ' '){ if(c[i] == ' '){
stoppC = i; stopC = i;
break; break;
} }
else if(stoppC == c.length-1){ else if(stopC == c.length-1){
break; break;
} }
} }
//cut the line //découper le mot
for(int i=startC;i<=stoppC;i++){ for(int i=startC;i<=stopC;i++){
cutLine += c[i]; cutLine += c[i];
} }
@ -164,18 +162,18 @@ public class TextEnemy {
newLine += cutLine+"\n"; newLine += cutLine+"\n";
cutLine = ""; cutLine = "";
//increase the start of the cut startC = stopC + 1;
startC = stoppC + 1;
if(c.length-1-stopC <=0){
//check if we can cut with the number specific or if it is shorter or it is finished
if(c.length-1-stoppC <=0){
break; break;
} }
else if(c.length-1-stoppC <= cut){ else if(c.length-1-stopC <= cut){
stoppC = c.length-1; stopC = c.length-1;
} }
else{ else{
stoppC += cut; stopC += cut;
} }
} }
} }