feat: modification de gamescreen et gamerenderer lancement de l'écran de jeu lors du click sur un niveau dans l'écran des mondes création de la barre d'outil du bas début création de la barre du haut
This commit is contained in:
parent
051bce8973
commit
a129e4c2f5
|
@ -43,6 +43,16 @@ public class ButtonLevel extends ImageTextButton {
|
||||||
return AssetLoader.Levelcolors[level.aWorld];
|
return AssetLoader.Levelcolors[level.aWorld];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPosition(float x, float y) {
|
||||||
|
super.setPosition(x,y);
|
||||||
|
level.X=x;
|
||||||
|
level.Y=y;
|
||||||
|
Thelabel.setColor(level.X/1024f,level.X/1024f,level.X/1024f,1f);
|
||||||
|
Thelabel.setPosition(level.X+54, level.Y*AssetLoader.ratio+20, Align.bottom | Align.center);
|
||||||
|
this.setColor(1f, 0.47f+(float)level.X/1024f*0.529f,0.607f+(float)level.X/768f*0.392f, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Batch batch, float parentAlpha) {
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
super.draw(batch, parentAlpha);
|
super.draw(batch, parentAlpha);
|
||||||
|
|
|
@ -88,17 +88,8 @@ public class AssetLoader {
|
||||||
Gdx.app.debug("AssetLoader","Ajout des textures disabled,over et down");
|
Gdx.app.debug("AssetLoader","Ajout des textures disabled,over et down");
|
||||||
Atlas_level = manager.get("textures/level.pack");
|
Atlas_level = manager.get("textures/level.pack");
|
||||||
if (manager.isLoaded("textures/level.pack")) {
|
if (manager.isLoaded("textures/level.pack")) {
|
||||||
for(int i=0; i < 5; i++)
|
for(String toload: new String[]{"leveler0","leveler1","leveler2","leveler3","leveler4","arrows","arrows2","exit2","cout","tech","cycle","temp","nrj","rayon","logo2"})
|
||||||
addstyle(Atlas_level,"leveler"+String.valueOf(i));
|
addstyle(Atlas_level,toload);
|
||||||
addstyle(Atlas_level,"arrows");
|
|
||||||
addstyle(Atlas_level,"arrows2");
|
|
||||||
addstyle(Atlas_level,"exit2");
|
|
||||||
addstyle(Atlas_level,"cout");
|
|
||||||
addstyle(Atlas_level,"tech");
|
|
||||||
addstyle(Atlas_level,"cycle");
|
|
||||||
addstyle(Atlas_level,"temp");
|
|
||||||
addstyle(Atlas_level,"nrj");
|
|
||||||
addstyle(Atlas_level,"rayon");
|
|
||||||
}
|
}
|
||||||
Gdx.app.debug("AssetLoader","Chargement des skins et attente fin chargement");
|
Gdx.app.debug("AssetLoader","Chargement des skins et attente fin chargement");
|
||||||
manager.load("textures/level.json", Skin.class, new SkinLoader.SkinParameter("textures/level.pack"));
|
manager.load("textures/level.json", Skin.class, new SkinLoader.SkinParameter("textures/level.pack"));
|
||||||
|
|
|
@ -30,7 +30,11 @@ public class Laser {
|
||||||
overlay=AssetLoader.Skin_level.getAtlas().findRegion("overlay");
|
overlay=AssetLoader.Skin_level.getAtlas().findRegion("overlay");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Batch Laser,float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
public void draw(Batch Laser,float xx1,float yy1,float xx2,float yy2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
||||||
|
float x1=xx1+26;
|
||||||
|
float y1=yy1+20;
|
||||||
|
float x2=xx2+26;
|
||||||
|
float y2=yy2+20;
|
||||||
Vector2 vectorall = new Vector2(x2, y2).sub(new Vector2(x1, y1));
|
Vector2 vectorall = new Vector2(x2, y2).sub(new Vector2(x1, y1));
|
||||||
float length = vectorall.len();
|
float length = vectorall.len();
|
||||||
Vector2 vectoradd = vectorall.scl(10/length);
|
Vector2 vectoradd = vectorall.scl(10/length);
|
||||||
|
@ -45,11 +49,12 @@ public class Laser {
|
||||||
Laser.end();
|
Laser.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawnotsoold(float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
public void drawnotsoold(ShapeRenderer Laser,float xx1,float yy1,float xx2,float yy2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
||||||
ShapeRenderer Laser=new ShapeRenderer();
|
float x1=xx1+58;
|
||||||
//Laser.begin(ShapeType.Line);
|
float y1=yy1+20;
|
||||||
|
float x2=xx2+58;
|
||||||
|
float y2=yy2+20;
|
||||||
Laser.begin(ShapeType.Filled);
|
Laser.begin(ShapeType.Filled);
|
||||||
//Gdx.gl.glEnable(GL20.GL_BLEND);
|
|
||||||
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
if (active) {
|
if (active) {
|
||||||
Vector2 vectorall = new Vector2(x2, y2).sub(new Vector2(x1, y1));
|
Vector2 vectorall = new Vector2(x2, y2).sub(new Vector2(x1, y1));
|
||||||
|
@ -77,14 +82,15 @@ public class Laser {
|
||||||
Laser.rectLine(x1, y1 , x2, y2, 2);
|
Laser.rectLine(x1, y1 , x2, y2, 2);
|
||||||
}
|
}
|
||||||
Laser.end();
|
Laser.end();
|
||||||
Laser.dispose();
|
|
||||||
Gdx.gl.glDisable(GL20.GL_BLEND);
|
Gdx.gl.glDisable(GL20.GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void drawold(float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
public void drawold(ShapeRenderer Laser,float xx1,float yy1,float xx2,float yy2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
||||||
ShapeRenderer Laser=new ShapeRenderer();
|
float x1=xx1+20;
|
||||||
//Laser.begin(ShapeType.Line);
|
float y1=yy1+20;
|
||||||
|
float x2=xx2+20;
|
||||||
|
float y2=yy2+20;
|
||||||
float adding=0;
|
float adding=0;
|
||||||
Laser.begin(ShapeType.Point);
|
Laser.begin(ShapeType.Point);
|
||||||
Vector2 vec2 = new Vector2(x2, y2).sub(new Vector2(x1, y1));
|
Vector2 vec2 = new Vector2(x2, y2).sub(new Vector2(x1, y1));
|
||||||
|
@ -110,8 +116,6 @@ public class Laser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Laser.end();
|
Laser.end();
|
||||||
Laser.dispose();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,47 +1,94 @@
|
||||||
package fr.evolving.screens;
|
package fr.evolving.screens;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
|
|
||||||
import fr.evolving.worlds.GameRenderer;
|
import fr.evolving.worlds.GameRenderer;
|
||||||
import fr.evolving.worlds.GameWorld;
|
import fr.evolving.worlds.GameWorld;
|
||||||
|
import fr.evolving.worlds.LevelRenderer;
|
||||||
|
import fr.evolving.assets.AssetLoader;
|
||||||
|
import fr.evolving.automata.Level;
|
||||||
import fr.evolving.inputs.InputHandler;
|
import fr.evolving.inputs.InputHandler;
|
||||||
|
|
||||||
public class GameScreen implements Screen {
|
public class GameScreen implements Screen {
|
||||||
|
private Timer ScrollTimer;
|
||||||
|
private TimerTask ScrollTask;
|
||||||
|
private Stage stage;
|
||||||
|
private Table table,table2;
|
||||||
private GameWorld world;
|
private GameWorld world;
|
||||||
private GameRenderer renderer;
|
private GameRenderer Renderer;
|
||||||
private float runTime;
|
private float runTime;
|
||||||
|
public Level level;
|
||||||
|
private ImageButton[] bottom;
|
||||||
|
private ImageButton[] topleft;
|
||||||
|
String[] bottom_tocreate={"run","stop","speed","separator","move","zoomp","zoomm","separator","raz","save","levels","tree","exits","separator","screen","sound","tuto","settings","separator","stat"};
|
||||||
|
String[] topleft_tocreate={"cycle","temp","nrj","rayon"};
|
||||||
|
|
||||||
|
|
||||||
// This is the constructor, not the class declaration
|
// This is the constructor, not the class declaration
|
||||||
public GameScreen() {
|
public GameScreen(Level level) {
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(),"Création des elements primordiaux du screen (stage, renderer, table, level, world)");
|
||||||
|
stage = new Stage(AssetLoader.viewport);
|
||||||
|
table = new Table();
|
||||||
|
table2 = new Table();
|
||||||
|
this.level=level;
|
||||||
|
world = new GameWorld(level);
|
||||||
|
Renderer = new GameRenderer(this);
|
||||||
|
world.setRenderer(Renderer);
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(),"Mise en place du timer.");
|
||||||
|
ScrollTimer=new Timer();
|
||||||
|
ScrollTask = new TimerTask()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Renderer.evolve();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du bas");
|
||||||
|
bottom=new ImageButton[bottom_tocreate.length];
|
||||||
|
int i=0;
|
||||||
|
for (String tocreateitem: bottom_tocreate)
|
||||||
|
bottom[i++]= new ImageButton(AssetLoader.Skin_level,tocreateitem);
|
||||||
|
topleft=new ImageButton[topleft_tocreate.length];
|
||||||
|
i=0;
|
||||||
|
for (String tocreateitem: topleft_tocreate)
|
||||||
|
topleft[i++]= new ImageButton(AssetLoader.Skin_level,tocreateitem);
|
||||||
|
|
||||||
float screenWidth = Gdx.graphics.getWidth();
|
|
||||||
float screenHeight = Gdx.graphics.getHeight();
|
|
||||||
float gameWidth = 136;
|
|
||||||
float gameHeight = screenHeight / (screenWidth / gameWidth);
|
|
||||||
int midPointY = (int) (gameHeight / 2);
|
|
||||||
|
|
||||||
world = new GameWorld(midPointY);
|
|
||||||
Gdx.input.setInputProcessor(new InputHandler(screenWidth / gameWidth, screenHeight / gameHeight));
|
|
||||||
renderer = new GameRenderer(world, (int) gameHeight, midPointY);
|
|
||||||
world.setRenderer(renderer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
runTime += delta;
|
runTime += delta;
|
||||||
world.update(delta);
|
world.update(delta);
|
||||||
renderer.render(delta, runTime);
|
Renderer.render(delta, runTime);
|
||||||
|
stage.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height) {
|
public void resize(int width, int height) {
|
||||||
|
AssetLoader.viewport.update(width,height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
Gdx.app.log("Affichage du GameScreen","ok");
|
Gdx.app.log("*****","Affichage du niveau.");
|
||||||
|
table.bottom().left().padBottom(10f);
|
||||||
|
for (int i=0;i<bottom_tocreate.length;i++)
|
||||||
|
table.add(bottom[i]).padLeft(10f);
|
||||||
|
stage.addActor(table);
|
||||||
|
table2.top().left().padTop(10f);
|
||||||
|
for (int i=0;i<topleft_tocreate.length;i++)
|
||||||
|
table2.add(topleft[i]).padLeft(10f);
|
||||||
|
stage.addActor(table2);
|
||||||
|
Gdx.input.setInputProcessor(stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,6 +105,7 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
stage.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package fr.evolving.screens;
|
package fr.evolving.screens;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Game;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
@ -44,6 +45,7 @@ public class LevelScreen implements Screen {
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
private Table table;
|
private Table table;
|
||||||
private ImageButton Previous,Next,Exit;
|
private ImageButton Previous,Next,Exit;
|
||||||
|
public ImageButton logosmall;
|
||||||
private ImageTextButton cout,tech,cycle,temp,rayon,nrj;
|
private ImageTextButton cout,tech,cycle,temp,rayon,nrj;
|
||||||
private TextButton buttonPlay,buttonExit;
|
private TextButton buttonPlay,buttonExit;
|
||||||
private Level[] thelevels;
|
private Level[] thelevels;
|
||||||
|
@ -77,17 +79,29 @@ public class LevelScreen implements Screen {
|
||||||
buttonLevels[i++].addListener(new ClickListener(){
|
buttonLevels[i++].addListener(new ClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
||||||
ButtonLevel button = (ButtonLevel)event.getListenerActor();
|
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Enter button "+button.level.Name);
|
Gdx.app.debug(getClass().getSimpleName(), "Enter button "+abutton.level.Name);
|
||||||
if (!button.isChecked())
|
if (!abutton.isChecked())
|
||||||
showlevel(button);
|
showlevel(abutton);
|
||||||
}
|
}
|
||||||
public void exit(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
public void exit(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
||||||
ButtonLevel button = (ButtonLevel)event.getListenerActor();
|
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Enter button "+button.level.Name);
|
Gdx.app.debug(getClass().getSimpleName(), "Enter button "+abutton.level.Name);
|
||||||
if (!button.isChecked())
|
if (!abutton.isChecked())
|
||||||
showlevel(button);
|
showlevel(abutton);
|
||||||
}
|
}
|
||||||
|
public void touchDragged(InputEvent event,float x,float y,int pointer) {
|
||||||
|
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
|
||||||
|
if (logosmall.isChecked()) {
|
||||||
|
abutton.setPosition(event.getStageX()-56, event.getStageY()-20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
|
||||||
|
ButtonLevel abutton = (ButtonLevel)event.getListenerActor();
|
||||||
|
if (!logosmall.isChecked()) {
|
||||||
|
((Game)Gdx.app.getApplicationListener()).setScreen(new GameScreen(abutton.level));
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +135,8 @@ public class LevelScreen implements Screen {
|
||||||
};
|
};
|
||||||
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
|
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Création des boutons.");
|
Gdx.app.debug(getClass().getSimpleName(),"Création des boutons.");
|
||||||
|
logosmall=new ImageButton(AssetLoader.Skin_level,"logosmall");
|
||||||
|
logosmall.setPosition(20, AssetLoader.height-175+logosmall.getHeight()/2);
|
||||||
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,"Descriptif");
|
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,"Descriptif");
|
||||||
TextDescriptive.setBounds(15, 15, 1185, 100);
|
TextDescriptive.setBounds(15, 15, 1185, 100);
|
||||||
buttonPlay = new TextButton("Connexions", AssetLoader.Skin_level,"Bouton");
|
buttonPlay = new TextButton("Connexions", AssetLoader.Skin_level,"Bouton");
|
||||||
|
@ -215,6 +231,7 @@ public class LevelScreen implements Screen {
|
||||||
stage.addActor(temp);
|
stage.addActor(temp);
|
||||||
stage.addActor(rayon);
|
stage.addActor(rayon);
|
||||||
stage.addActor(Victory);
|
stage.addActor(Victory);
|
||||||
|
stage.addActor(logosmall);
|
||||||
Gdx.input.setInputProcessor(stage);
|
Gdx.input.setInputProcessor(stage);
|
||||||
Gdx.app.debug("AssetLoader","Début dans la bande son \'intro\'");
|
Gdx.app.debug("AssetLoader","Début dans la bande son \'intro\'");
|
||||||
AssetLoader.intro.setLooping(true);
|
AssetLoader.intro.setLooping(true);
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class SplashScreen implements Screen {
|
||||||
splashImage.setScale(scale);
|
splashImage.setScale(scale);
|
||||||
splashImage.setPosition((AssetLoader.width / 2) - (scale * splashImage.getWidth() / 2), (AssetLoader.height / 2) - (scale * splashImage.getHeight() / 2));
|
splashImage.setPosition((AssetLoader.width / 2) - (scale * splashImage.getWidth() / 2), (AssetLoader.height / 2) - (scale * splashImage.getHeight() / 2));
|
||||||
stage.addActor(splashImage);
|
stage.addActor(splashImage);
|
||||||
splashImage.addAction(Actions.sequence(Actions.alpha(0),Actions.fadeIn(5f),Actions.run(new Runnable() {
|
splashImage.addAction(Actions.sequence(Actions.alpha(0),Actions.fadeIn(3f),Actions.run(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AssetLoader.finishall();
|
AssetLoader.finishall();
|
||||||
|
|
|
@ -14,57 +14,36 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
|
||||||
|
|
||||||
import fr.evolving.assets.AssetLoader;
|
import fr.evolving.assets.AssetLoader;
|
||||||
import fr.evolving.inputs.InputHandler;
|
import fr.evolving.inputs.InputHandler;
|
||||||
|
import fr.evolving.screens.GameScreen;
|
||||||
|
|
||||||
public class GameRenderer {
|
public class GameRenderer {
|
||||||
|
|
||||||
private GameWorld myWorld;
|
private GameWorld myWorld;
|
||||||
private OrthographicCamera cam;
|
|
||||||
private ShapeRenderer shapeRenderer;
|
private ShapeRenderer shapeRenderer;
|
||||||
private SpriteBatch batcher;
|
private SpriteBatch batcher;
|
||||||
|
private GameScreen GameScreen;
|
||||||
|
|
||||||
private int midPointY;
|
public void evolve() {
|
||||||
|
|
||||||
public GameRenderer(GameWorld world, int gameHeight, int midPointY) {
|
|
||||||
myWorld = world;
|
|
||||||
|
|
||||||
this.midPointY = midPointY;
|
|
||||||
|
|
||||||
cam = new OrthographicCamera();
|
|
||||||
cam.setToOrtho(true, 136, gameHeight);
|
|
||||||
|
|
||||||
batcher = new SpriteBatch();
|
|
||||||
batcher.setProjectionMatrix(cam.combined);
|
|
||||||
shapeRenderer = new ShapeRenderer();
|
|
||||||
shapeRenderer.setProjectionMatrix(cam.combined);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GameRenderer(GameScreen GameScreen) {
|
||||||
|
this.GameScreen=GameScreen;
|
||||||
|
batcher = new SpriteBatch();
|
||||||
|
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||||
|
shapeRenderer = new ShapeRenderer();
|
||||||
|
shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||||
|
}
|
||||||
|
|
||||||
public void render(float delta, float runTime) {
|
public void render(float delta, float runTime) {
|
||||||
|
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
shapeRenderer.begin(ShapeType.Filled);
|
shapeRenderer.begin(ShapeType.Filled);
|
||||||
|
shapeRenderer.setColor(0.2f, 0.2f, 0.2f, 0.5f);
|
||||||
// Draw Background color
|
shapeRenderer.rect(5, 5, AssetLoader.width-10, 74);
|
||||||
shapeRenderer.setColor(55 / 255.0f, 80 / 255.0f, 100 / 255.0f, 1);
|
shapeRenderer.rect(5, AssetLoader.height-81, 550, 74);
|
||||||
shapeRenderer.rect(0, 0, 136, midPointY + 66);
|
|
||||||
|
|
||||||
// Draw Grass
|
|
||||||
shapeRenderer.setColor(111 / 255.0f, 186 / 255.0f, 45 / 255.0f, 1);
|
|
||||||
shapeRenderer.rect(0, midPointY + 66, 136, 11);
|
|
||||||
|
|
||||||
// Draw Dirt
|
|
||||||
shapeRenderer.setColor(147 / 255.0f, 80 / 255.0f, 27 / 255.0f, 1);
|
|
||||||
shapeRenderer.rect(0, midPointY + 77, 136, 52);
|
|
||||||
|
|
||||||
shapeRenderer.end();
|
shapeRenderer.end();
|
||||||
|
|
||||||
batcher.begin();
|
batcher.begin();
|
||||||
batcher.disableBlending();
|
batcher.disableBlending();
|
||||||
|
|
||||||
//batcher.draw(bg, 0, midPointY + 23, 136, 43);
|
|
||||||
|
|
||||||
batcher.end();
|
batcher.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.badlogic.gdx.math.Rectangle;
|
||||||
import fr.evolving.assets.SaveObject;
|
import fr.evolving.assets.SaveObject;
|
||||||
import fr.evolving.assets.AssetLoader;
|
import fr.evolving.assets.AssetLoader;
|
||||||
import fr.evolving.automata.Grid;
|
import fr.evolving.automata.Grid;
|
||||||
|
import fr.evolving.automata.Level;
|
||||||
|
|
||||||
public class GameWorld {
|
public class GameWorld {
|
||||||
private float runTime = 0;
|
private float runTime = 0;
|
||||||
|
@ -20,17 +21,17 @@ public class GameWorld {
|
||||||
MENU, READY, RUNNING, GAMEOVER, OPTION
|
MENU, READY, RUNNING, GAMEOVER, OPTION
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameWorld(int midPointY) {
|
public GameWorld(Level level) {
|
||||||
Gdx.app.log("Creation du plateau de jeu","ok");
|
Gdx.app.log("Creation du plateau de jeu","ok");
|
||||||
currentState = GameState.MENU;
|
currentState = GameState.MENU;
|
||||||
myGrid= new Grid(20,20);
|
myGrid= new Grid(20,20);
|
||||||
//MySaveObject= new SaveObject("com.mysql.jdbc.Driver","jdbc:mysql://dahut.fr:3306/popfr_games","popfr_games","ef^J,khGMIL~");
|
//MySaveObject= new SaveObject("com.mysql.jdbc.Driver","jdbc:mysql://dahut.fr:3306/popfr_games","popfr_games","ef^J,khGMIL~");
|
||||||
MySaveObject= new SaveObject("com.mysql.jdbc.Driver","jdbc:mysql://192.168.1.252:3306/games","games","WoawGames!!87");
|
//MySaveObject= new SaveObject("com.mysql.jdbc.Driver","jdbc:mysql://192.168.1.252:3306/games","games","WoawGames!!87");
|
||||||
try {
|
//try {
|
||||||
MySaveObject.saveObject(myGrid);
|
// MySaveObject.saveObject(myGrid);
|
||||||
} catch (Exception e) {
|
//} catch (Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(float delta) {
|
public void update(float delta) {
|
||||||
|
|
|
@ -30,8 +30,7 @@ public class LevelRenderer {
|
||||||
int diry;
|
int diry;
|
||||||
LevelScreen LevelScreen;
|
LevelScreen LevelScreen;
|
||||||
Laser Laser;
|
Laser Laser;
|
||||||
TextureRegion Texture_logobig;
|
public TextureRegion Texture_logobig;
|
||||||
TextureRegion Texture_logosmall;
|
|
||||||
BitmapFont font;
|
BitmapFont font;
|
||||||
|
|
||||||
public LevelRenderer(LevelScreen LevelScreen) {
|
public LevelRenderer(LevelScreen LevelScreen) {
|
||||||
|
@ -84,8 +83,6 @@ public class LevelRenderer {
|
||||||
batcher2.setProjectionMatrix(AssetLoader.Camera.combined);
|
batcher2.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||||
batcher2.setColor(Color.WHITE);
|
batcher2.setColor(Color.WHITE);
|
||||||
Texture_logobig=AssetLoader.Skin_level.getRegion("logo3");
|
Texture_logobig=AssetLoader.Skin_level.getRegion("logo3");
|
||||||
Texture_logosmall=AssetLoader.Skin_level.getRegion("logo2");
|
|
||||||
batcher2.draw(Texture_logosmall,20, AssetLoader.height-Texture_logobig.getRegionHeight()+Texture_logosmall.getRegionHeight()/2);
|
|
||||||
batcher2.draw(Texture_logobig,120, AssetLoader.height-Texture_logobig.getRegionHeight());
|
batcher2.draw(Texture_logobig,120, AssetLoader.height-Texture_logobig.getRegionHeight());
|
||||||
font.draw(batcher2, LevelScreen.selected.level.Name, 15, 145);
|
font.draw(batcher2, LevelScreen.selected.level.Name, 15, 145);
|
||||||
if (LevelScreen.selected!=null && LevelScreen.selected.level.Tech>0)
|
if (LevelScreen.selected!=null && LevelScreen.selected.level.Tech>0)
|
||||||
|
@ -131,7 +128,10 @@ public class LevelRenderer {
|
||||||
}
|
}
|
||||||
if (found!=-1)
|
if (found!=-1)
|
||||||
{
|
{
|
||||||
Laser.draw(batcher,LevelScreen.buttonLevels[i].level.X+20,LevelScreen.buttonLevels[i].level.Y*AssetLoader.ratio+20,LevelScreen.buttonLevels[found].level.X+20,LevelScreen.buttonLevels[found].level.Y*AssetLoader.ratio+20,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor());
|
if (!LevelScreen.logosmall.isChecked())
|
||||||
|
Laser.draw(batcher,LevelScreen.buttonLevels[i].level.X,LevelScreen.buttonLevels[i].level.Y*AssetLoader.ratio,LevelScreen.buttonLevels[found].level.X,LevelScreen.buttonLevels[found].level.Y*AssetLoader.ratio,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor());
|
||||||
|
else
|
||||||
|
Laser.drawnotsoold(shapeRenderer,LevelScreen.buttonLevels[i].level.X,LevelScreen.buttonLevels[i].level.Y*AssetLoader.ratio,LevelScreen.buttonLevels[found].level.X,LevelScreen.buttonLevels[found].level.Y*AssetLoader.ratio,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue