mirror of
https://github.com/Klagarge/PokeHES.git
synced 2024-11-23 01:43:28 +00:00
change title
This commit is contained in:
parent
7273a6b1a3
commit
c7c6274be1
@ -41,6 +41,8 @@ public class PokeHES extends PortableApplication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInit() {
|
public void onInit() {
|
||||||
|
setTitle("PokeHES");
|
||||||
|
|
||||||
sp.init();
|
sp.init();
|
||||||
controller.init();
|
controller.init();
|
||||||
|
|
||||||
@ -64,6 +66,7 @@ public class PokeHES extends PortableApplication {
|
|||||||
@Override
|
@Override
|
||||||
public void onGraphicRender(GdxGraphics g) {
|
public void onGraphicRender(GdxGraphics g) {
|
||||||
g.clear();
|
g.clear();
|
||||||
|
|
||||||
boolean onMapScreen = sp.screenManager.getActiveScreen().getClass().equals(ScreenMap.class);
|
boolean onMapScreen = sp.screenManager.getActiveScreen().getClass().equals(ScreenMap.class);
|
||||||
boolean onBattleScreen = sp.screenManager.getActiveScreen().getClass().equals(ScreenBattle.class);
|
boolean onBattleScreen = sp.screenManager.getActiveScreen().getClass().equals(ScreenBattle.class);
|
||||||
boolean onEndScreen = sp.screenManager.getActiveScreen().getClass().equals(ScreenEnd.class);
|
boolean onEndScreen = sp.screenManager.getActiveScreen().getClass().equals(ScreenEnd.class);
|
||||||
@ -74,34 +77,24 @@ public class PokeHES extends PortableApplication {
|
|||||||
sp.p.removedPv(1);
|
sp.p.removedPv(1);
|
||||||
for (Enemy enemy : enemies) { enemy.recoveredTime++; }
|
for (Enemy enemy : enemies) { enemy.recoveredTime++; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//end of the game
|
|
||||||
if((sp.p.getPv() <= 0 || sp.p.getXp() >= sp.p.getXpMax() ) && !onEndScreen ) {
|
|
||||||
g.zoom(1);
|
|
||||||
g.resetCamera();
|
|
||||||
sp.se = sp.screenManager.getScreenEnd();
|
|
||||||
System.out.println("Game finished");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(onMapScreen) sp.p.manageEntity(sp.sm, controller);
|
if(onMapScreen) sp.p.manageEntity(sp.sm, controller);
|
||||||
|
|
||||||
|
// Switch to battle
|
||||||
|
if (sp.p.onEnemy && onMapScreen){ // if player is onEnemy and on map screen
|
||||||
// Switch screen
|
sp.e = sp.p.lastEnemy; // Get this enemy
|
||||||
if (sp.p.onEnemy && onMapScreen){
|
|
||||||
sp.e = sp.p.lastEnemy;
|
int pv = sp.e.getPv(); // get how many pv have the enemy
|
||||||
|
|
||||||
int pv = sp.e.getPv();
|
|
||||||
boolean recovered = sp.e.recoveredTime>=Settings.RECOVERED;
|
boolean recovered = sp.e.recoveredTime>=Settings.RECOVERED;
|
||||||
|
|
||||||
|
// if the enemy is alive and have recovered, switch to Battle
|
||||||
if (pv>0 && recovered) {
|
if (pv>0 && recovered) {
|
||||||
sp.b = new Battle(sp.e);
|
sp.b = new Battle(sp.e);
|
||||||
sp.sb = sp.screenManager.getScreenBattle();
|
sp.sb = sp.screenManager.getScreenBattle();
|
||||||
|
|
||||||
//set pv and xp to display
|
//set pv and xp to display
|
||||||
sp.b.setXpPlayer(sp.p.getXp());
|
sp.b.setXpPlayer(sp.p.getXp());
|
||||||
|
|
||||||
g.zoom(1);
|
g.zoom(1);
|
||||||
g.resetCamera();
|
g.resetCamera();
|
||||||
} else {
|
} else {
|
||||||
@ -110,9 +103,10 @@ public class PokeHES extends PortableApplication {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(onBattleScreen) sp.sb.manage(controller, sp.b);
|
if(onBattleScreen) sp.sb.manage(controller, sp.b);
|
||||||
|
|
||||||
|
// switch to Map
|
||||||
if(!sp.b.getScreenBattleOn() && onBattleScreen){
|
if(!sp.b.getScreenBattleOn() && onBattleScreen){
|
||||||
//addXp for the player
|
//addXp for the player
|
||||||
sp.p.addXp(sp.b.getNewXp());
|
sp.p.addXp(sp.b.getNewXp());
|
||||||
@ -123,6 +117,14 @@ public class PokeHES extends PortableApplication {
|
|||||||
sp.sm = sp.screenManager.getScreenMap();
|
sp.sm = sp.screenManager.getScreenMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// End of the game
|
||||||
|
if((sp.p.getPv() <= 0 || sp.p.getXp() >= sp.p.getXpMax() ) && !onEndScreen ) {
|
||||||
|
g.zoom(1);
|
||||||
|
g.resetCamera();
|
||||||
|
sp.se = sp.screenManager.getScreenEnd();
|
||||||
|
System.out.println("Game finished");
|
||||||
|
}
|
||||||
|
|
||||||
// Graphics render
|
// Graphics render
|
||||||
sp.render(g);
|
sp.render(g);
|
||||||
for (Entity entity : entities) {
|
for (Entity entity : entities) {
|
||||||
|
@ -42,7 +42,7 @@ public class ScreenEnd extends RenderingScreen{
|
|||||||
//set a different text if the player win or loose
|
//set a different text if the player win or loose
|
||||||
public void setText(Player p){
|
public void setText(Player p){
|
||||||
if(p.getXp() >= p.getXpMax()){
|
if(p.getXp() >= p.getXpMax()){
|
||||||
textEnd = "Bravo, tu as réussi ton année avec " + p.getXp()/100.0 + " crédits en " + (Settings.TIME*60-p.getPv()) + " secondes.\n\nMais, seras-tu près pour le prochain....";
|
textEnd = "Bravo, tu as réussi ton année avec " + p.getXp()/100.0 + " crédits en " + (Settings.TIME*60-p.getPv()) + " secondes.\n\nMais, seras-tu près pour la prochaine....";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
textEnd = "L'année est terminée et tu as obtenu " + p.getXp()/100.0 + " crédits.\n\nA l'année prochaine...";
|
textEnd = "L'année est terminée et tu as obtenu " + p.getXp()/100.0 + " crédits.\n\nA l'année prochaine...";
|
||||||
|
Loading…
Reference in New Issue
Block a user