Merge pull request #46 from Klagarge/add-FabLab

Add-FabLab
This commit is contained in:
Rémi Heredero authored and GitHub committed 2022-06-17 08:57:02 +02:00
commit b67798adb5
89 files changed
+203 -77

No files matched your search

+1 -1
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
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 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

File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

File renamed without changes.
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

+9 -1
View File
@@ -1,5 +1,5 @@
<?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="229" source="assets/pokemon_v2.tsx"/>
<layer id="1" name="floor" width="30" height="24">
@@ -103,5 +103,13 @@
<property name="nextY" type="int" value="8"/>
</properties>
</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>
</map>
+70
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
View File
Binary file not shown.
+6
View File
@@ -5,6 +5,12 @@ import java.util.TreeMap;
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 Map<Integer, Boolean> keyStatus = new TreeMap<Integer, Boolean>();
+6
View File
@@ -2,6 +2,12 @@ package Control;
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 void keyDown(int keycode, ScreenPlayer sp, Controller c) {
c.keyStatus.put(keycode, true);
+13 -6
View File
@@ -7,8 +7,15 @@ import com.badlogic.gdx.math.Vector2;
import ch.hevs.gdx2d.components.bitmaps.Spritesheet;
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{
// Each character have a direction for orientation and where it will go
public enum Direction{
UP,
DOWN,
@@ -21,13 +28,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 +52,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 +147,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;
+14 -7
View File
@@ -6,21 +6,28 @@ import Main.Settings;
public class Enemy extends Character{
private String branch;
private String subject;
public int recoveredTime = Settings.RECOVERED;
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
this.map = map;
turn(dir);
this.branch = branch;
this.subject = subject;
this.pv = pv;
@@ -44,7 +51,7 @@ public class Enemy extends Character{
}
public String getBranch(){
return branch;
return subject;
}
@Override
+7 -1
View File
@@ -6,6 +6,13 @@ import ch.hevs.gdx2d.components.bitmaps.Spritesheet;
import ch.hevs.gdx2d.lib.GdxGraphics;
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 {
protected String name;
protected String map;
@@ -51,7 +58,6 @@ public abstract class Entity implements DrawableObject {
}
public void graphicRender(GdxGraphics g){
}
/**
+24 -6
View File
@@ -18,8 +18,14 @@ public class Player extends Character{
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);
/**
* 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;
}
@@ -31,7 +37,12 @@ public class Player extends Character{
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());
@@ -70,7 +81,7 @@ public class Player extends Character{
turn(goalDirection);
System.out.println("It's a enemy !!");
} else {
setSpeed(sm.getSpeed(nextCell)*3); //TODO remove x3
setSpeed(sm.getSpeed(nextCell)*1.5f);
go(goalDirection);
}
} else {
@@ -81,7 +92,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,6 +105,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
setPosition(x*sm.tileWidth, y*sm.tileHeight);
turn(goalDirection);
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();
for (Enemy enemy : enemies) {
boolean bMap = sm.map.equals(enemy.getMap());
+4 -4
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");
}
+6 -7
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
+2 -2
View File
@@ -4,9 +4,9 @@ public class Settings {
public static final boolean ANDROID = false;
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 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;
+13 -11
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;
@@ -33,9 +33,9 @@ public class ScreenBattle extends RenderingScreen{
@Override
public void onInit() {
//generate the fonts
unbuntuRegularBlack = generateFont("./Data/font/Ubuntu-Regular.ttf", 30, Color.BLACK);
unbuntuRegularWhite = generateFont("./Data/font/Ubuntu-Regular.ttf", 45, Color.WHITE);
//display the question
ubuntuRegularBlack = generateFont("./Data/font/Ubuntu-Regular.ttf", 30, Color.BLACK);
ubuntuRegularWhite = generateFont("./Data/font/Ubuntu-Regular.ttf", 45, Color.WHITE);
}
@@ -51,8 +51,8 @@ public class ScreenBattle extends RenderingScreen{
@Override
public void dispose() {
unbuntuRegularBlack.dispose();
unbuntuRegularWhite.dispose();
ubuntuRegularBlack.dispose();
ubuntuRegularWhite.dispose();
}
//set the images for the player and the enemy
@@ -87,21 +87,23 @@ public class ScreenBattle extends RenderingScreen{
//draw the dialog
if(b == 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){
//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);
}
public void displayPlayer(GdxGraphics g){
//draw image
g.drawPicture((192/2), HEIGHT_DIALOG + 10 + 240/2, playerImg);
//draw pv and xp
g.drawString(255, HEIGHT_DIALOG + 100 , "XP : " + b.xpPlayer + " / " + b.player.getXpMax() + "\nPV : " + b.player.getPv() + " / " + Settings.TIME*60, unbuntuRegularWhite);
//draw pv
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){
-1
View File
@@ -9,7 +9,6 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFont
import Entity.Player;
import Main.Settings;
import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
import ch.hevs.gdx2d.lib.GdxGraphics;
+1
View File
@@ -68,6 +68,7 @@ public class ScreenMap extends RenderingScreen{
createMap("23RI");
createMap("23RS");
createMap("FabLab");
createMap("23N1");
createMap("23N2");
createMap("23N215");
+1 -2
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
+1 -1
View File
@@ -34,7 +34,7 @@ public class FightData {
attacks.add(attack);
line = bf.readLine();
//add line
nbre_line++;
nbr_line++;
}
bf.close();
+25 -27
View File
@@ -1,12 +1,12 @@
package Text;
import Entity.Enemy;
import java.util.Vector;
import java.util.Arrays;
import java.util.Random;
public class TextEnemy {
private static final int CUT = 60;
private static final int CUT = 55;
public FightData fightData;
public SpeechData speechData;
@@ -26,13 +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[]>();
}
//generate a random array width different number
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;
@@ -42,24 +41,24 @@ 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();
// Starting from the last element and swapping one by one.
for (int i = a.length-1; i > 0; i--) {
// Pick a random index from 0 to i
int j = rd.nextInt(i+1);
// Swap array[i] with the element at random index
int temp = a[i];
a[i] = a[j];
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;
@@ -74,10 +73,8 @@ public class TextEnemy {
String introduction = formatLine(speechData.getSpeechs(0), CUT);
lines.add(new Line(introduction, false));
//generate a random array for determin the order of the attack
orderAttack = randomGenerate(0, fightData.nbre_line-1, 4);
orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
//go trough which attack
for(int j=0; j<4;j++){
int[] currentRandom = new int[5];
currentRandom[0] = orderAttack[j];
@@ -129,7 +126,7 @@ public class TextEnemy {
String newLine = "";
int startC = 0;
int stoppC = cut;
int stopC = cut;
//check if the line is shorter than the character limit
if(cut>line.length()-1){
@@ -144,19 +141,20 @@ public class TextEnemy {
}
while(true){
//cut the line only if there is a space
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;
}
}
//cut the line
for(int i=startC;i<=stoppC;i++){
//découper le mot
for(int i=startC;i<=stopC;i++){
cutLine += c[i];
}
@@ -164,18 +162,18 @@ public class TextEnemy {
newLine += cutLine+"\n";
cutLine = "";
//increase the start of the cut
startC = stoppC + 1;
startC = stopC + 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;
}
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;
}
}
}