mirror of
https://github.com/Klagarge/PokeHES.git
synced 2024-11-23 01:43:28 +00:00
b
This commit is contained in:
parent
f21a8c7482
commit
d33945ccf4
@ -9,4 +9,6 @@ public class Battle {
|
|||||||
* barre de vie
|
* barre de vie
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ public class PokeMudry extends PortableApplication {
|
|||||||
private static Vector<Enemy> enemies = new Vector<>();
|
private static Vector<Enemy> enemies = new Vector<>();
|
||||||
private static Vector<Entity> entities = new Vector<>();
|
private static Vector<Entity> entities = new Vector<>();
|
||||||
|
|
||||||
|
public static boolean front_montant = false;
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new PokeMudry();
|
new PokeMudry();
|
||||||
@ -74,7 +76,7 @@ public class PokeMudry extends PortableApplication {
|
|||||||
@Override
|
@Override
|
||||||
public void onKeyDown(int keycode) {
|
public void onKeyDown(int keycode) {
|
||||||
super.onKeyDown(keycode);
|
super.onKeyDown(keycode);
|
||||||
|
front_montant = true;
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case Input.Keys.Z:
|
case Input.Keys.Z:
|
||||||
if (sp.sm.zoom == 1.0) {
|
if (sp.sm.zoom == 1.0) {
|
||||||
@ -93,6 +95,7 @@ public class PokeMudry extends PortableApplication {
|
|||||||
@Override
|
@Override
|
||||||
public void onKeyUp(int keycode) {
|
public void onKeyUp(int keycode) {
|
||||||
super.onKeyUp(keycode);
|
super.onKeyUp(keycode);
|
||||||
|
front_montant = false;
|
||||||
controller.keyStatus.put(keycode, false);
|
controller.keyStatus.put(keycode, false);
|
||||||
sp.screenManager.getActiveScreen().onKeyDown(keycode);
|
sp.screenManager.getActiveScreen().onKeyDown(keycode);
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,15 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
|
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
import Control.Controller;
|
import Control.Controller;
|
||||||
import Entity.Enemy;
|
import Entity.Enemy;
|
||||||
import Entity.Player;
|
import Entity.Player;
|
||||||
|
import Game.Battle;
|
||||||
import Text.Line;
|
import Text.Line;
|
||||||
import Text.TextEnemy;
|
import Text.TextEnemy;
|
||||||
|
import Main.PokeMudry;
|
||||||
import Main.Settings;
|
import Main.Settings;
|
||||||
|
|
||||||
public class ScreenBattle extends RenderingScreen{
|
public class ScreenBattle extends RenderingScreen{
|
||||||
@ -29,9 +30,12 @@ public class ScreenBattle extends RenderingScreen{
|
|||||||
|
|
||||||
private BitmapFont optimus40;
|
private BitmapFont optimus40;
|
||||||
|
|
||||||
|
private Battle battle;
|
||||||
|
|
||||||
private TextEnemy textEnemy;
|
private TextEnemy textEnemy;
|
||||||
private int lineSpeech = 0;
|
private static int lineSpeech = 0;
|
||||||
private String lineDialog = "";
|
private static String lineDialog = "";
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
private int answer = 0;
|
private int answer = 0;
|
||||||
|
|
||||||
@ -44,7 +48,8 @@ public class ScreenBattle extends RenderingScreen{
|
|||||||
textEnemy = new TextEnemy("enemi");
|
textEnemy = new TextEnemy("enemi");
|
||||||
textEnemy.generateText();
|
textEnemy.generateText();
|
||||||
|
|
||||||
|
//new battle game
|
||||||
|
battle = new Battle();
|
||||||
|
|
||||||
|
|
||||||
//display the question
|
//display the question
|
||||||
@ -53,21 +58,24 @@ public class ScreenBattle extends RenderingScreen{
|
|||||||
|
|
||||||
//initialize the first line
|
//initialize the first line
|
||||||
readNextLine();
|
readNextLine();
|
||||||
|
System.out.println(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGraphicRender(GdxGraphics g) {
|
public void onGraphicRender(GdxGraphics g) {
|
||||||
g.clear(Color.BLACK);
|
g.clear(Color.BLACK);
|
||||||
|
|
||||||
displayDialog(g);
|
displayDialog(g);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
||||||
optimus40.dispose();
|
optimus40.dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateFont(String file, int height, Color c ){
|
public void generateFont(String file, int height, Color c ){
|
||||||
@ -84,7 +92,7 @@ public class ScreenBattle extends RenderingScreen{
|
|||||||
|
|
||||||
public void displayDialog(GdxGraphics g){
|
public void displayDialog(GdxGraphics g){
|
||||||
//dialog background
|
//dialog background
|
||||||
g.drawFilledRectangle(Settings.SIDE/2, HEIGHT_DIALOG/2 + EDGE, 1600, HEIGHT_DIALOG, 0);
|
g.drawFilledRectangle(Settings.SIDE/2, HEIGHT_DIALOG/2 + EDGE, WIDTH_DIALOG, HEIGHT_DIALOG, 0);
|
||||||
|
|
||||||
//dialog
|
//dialog
|
||||||
g.drawString(15, 245 ,lineDialog , optimus40);
|
g.drawString(15, 245 ,lineDialog , optimus40);
|
||||||
@ -106,41 +114,44 @@ public class ScreenBattle extends RenderingScreen{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void manage(Controller c){
|
public void manage(Controller c){
|
||||||
|
if(PokeMudry.front_montant){
|
||||||
if (c.keyStatus.get(Input.Keys.SPACE)){
|
if (c.keyStatus.get(Input.Keys.SPACE)){
|
||||||
if(textEnemy.lines.get(lineSpeech).attackOn == false){
|
if(textEnemy.lines.get(lineSpeech).attackOn == false){
|
||||||
readNextLine();
|
readNextLine();
|
||||||
}
|
}
|
||||||
|
else if (c.keyStatus.get(Input.Keys.NUM_1)){
|
||||||
}
|
|
||||||
if (c.keyStatus.get(Input.Keys.NUM_1)){
|
|
||||||
if(textEnemy.lines.get(lineSpeech).attackOn == true){
|
if(textEnemy.lines.get(lineSpeech).attackOn == true){
|
||||||
readNextLine();
|
readNextLine();
|
||||||
answer = 1;
|
answer = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c.keyStatus.get(Input.Keys.NUM_2)){
|
else if (c.keyStatus.get(Input.Keys.NUM_2)){
|
||||||
if(textEnemy.lines.get(lineSpeech).attackOn == true){
|
if(textEnemy.lines.get(lineSpeech).attackOn == true){
|
||||||
readNextLine();
|
readNextLine();
|
||||||
answer = 2;
|
answer = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c.keyStatus.get(Input.Keys.NUM_3)){
|
else if (c.keyStatus.get(Input.Keys.NUM_3)){
|
||||||
if(textEnemy.lines.get(lineSpeech).attackOn == true){
|
if(textEnemy.lines.get(lineSpeech).attackOn == true){
|
||||||
readNextLine();
|
readNextLine();
|
||||||
answer = 3;
|
answer = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c.keyStatus.get(Input.Keys.NUM_4)){
|
else if (c.keyStatus.get(Input.Keys.NUM_4)){
|
||||||
if(textEnemy.lines.get(lineSpeech).attackOn == true){
|
if(textEnemy.lines.get(lineSpeech).attackOn == true){
|
||||||
readNextLine();
|
readNextLine();
|
||||||
answer = 4;
|
answer = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mettre le front à false jusqu'à ce que le bouton soit relâché
|
||||||
|
PokeMudry.front_montant = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,14 @@ import java.util.TreeMap;
|
|||||||
import Control.Controller;
|
import Control.Controller;
|
||||||
import Entity.Enemy;
|
import Entity.Enemy;
|
||||||
import Screen.ScreenBattle;
|
import Screen.ScreenBattle;
|
||||||
|
import Screen.ScreenPlayer;
|
||||||
import ch.hevs.gdx2d.desktop.PortableApplication;
|
import ch.hevs.gdx2d.desktop.PortableApplication;
|
||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
|
import ch.hevs.gdx2d.lib.GdxGraphics;
|
||||||
import ch.hevs.gdx2d.lib.ScreenManager;
|
import ch.hevs.gdx2d.lib.ScreenManager;
|
||||||
|
|
||||||
public class testYann extends PortableApplication{
|
public class testYann extends PortableApplication{
|
||||||
|
|
||||||
private ScreenManager s = new ScreenManager();
|
ScreenPlayer sp = new ScreenPlayer();
|
||||||
public Map<Integer, Boolean> keyStatus = new TreeMap<Integer, Boolean>();
|
public Map<Integer, Boolean> keyStatus = new TreeMap<Integer, Boolean>();
|
||||||
double zoom;
|
double zoom;
|
||||||
Controller controller = new Controller();
|
Controller controller = new Controller();
|
||||||
@ -28,15 +29,16 @@ public class testYann extends PortableApplication{
|
|||||||
@Override
|
@Override
|
||||||
public void onInit() {
|
public void onInit() {
|
||||||
|
|
||||||
s.registerScreen(ScreenBattle.class);
|
|
||||||
Enemy e = new Enemy("enemi", 50, 50, "resources//lumberjack_sheet32.png", "desert");
|
Enemy e = new Enemy("enemi", 50, 50, "resources//lumberjack_sheet32.png", "desert");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGraphicRender(GdxGraphics g) {
|
public void onGraphicRender(GdxGraphics g) {
|
||||||
s.render(g);
|
|
||||||
|
|
||||||
|
sp.render(g);
|
||||||
|
sp.sb.manage(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user