1
0
Fork 0
This commit is contained in:
MrDev023 2017-01-21 20:48:41 +01:00
parent de8b0708c7
commit bcaa063263
4 changed files with 50 additions and 24 deletions

View file

@ -2,9 +2,9 @@ package globalgamejam.game;
public enum EObjetType {
POISSON("res/textures/dechets1.png",-2, 0.5f),POMME("res/textures/dechets.png",-3, 0.5f),
ETOILE_DE_MER("res/textures/bonus1.png",2, 0.5f),COQUILLAGE("res/textures/bonus2.png",3, 0.5f),
COQUILLAGE2("res/textures/bonus3.png",4, 0.5f),BANANE("res/textures/banane.png",-5, 0.5f);
POISSON("res/textures/dechets1.png",-2, 0.75f),POMME("res/textures/dechets.png",-3, 0.75f),
ETOILE_DE_MER("res/textures/bonus1.png",2, 0.75f),COQUILLAGE("res/textures/bonus2.png",3, 0.75f),
COQUILLAGE2("res/textures/bonus3.png",4, 0.75f),BANANE("res/textures/banane.png",-5, 0.75f);
private int points;
private String filename;

View file

@ -25,7 +25,7 @@ public class Player extends PhysicalEntity {
super(x, y, 0, 0, 3, 0, 0, 10);
this.tile = new PlayerTile(path, x, y);
this.setSizeXY(this.tile.getTexture().width, this.tile.getTexture().height);
this.setSizeXY(this.tile.getTexture().width, this.tile.getTexture().width);
this.longueurBalai = 82;
@ -50,6 +50,21 @@ public class Player extends PhysicalEntity {
this.brosse.addPosition(x, y);
}
/* @Override
public boolean collideWithMur(PhysicalEntity entity){
float distX = this.x - entity.getX();
float distY = this.y - entity.getY();
float dist = (float)Math.sqrt( distX * distX + distY * distY );
return dist <= this.sizeRadius + entity.sizeRadius;
}*/
@Override
public void resolveCollideWith(PhysicalEntity entity){
}
public void rotate(float angleRotation){
this.angle += angleRotation;
this.angle %= 360;

View file

@ -56,8 +56,8 @@ public class MainInterfaces {
}
public void init(){
p1 = new GUILabel("Player 1 : ", Main.WIDTH/4,10, Color.BLACK,"Arial",16);
p2 = new GUILabel("Player 2 : ", Main.WIDTH/4 * 3,10, Color.BLACK,"Arial",16);
p1 = new GUILabel("Player 1 : ", Main.WIDTH/4,10, Color.RED,"Arial",16);
p2 = new GUILabel("Player 2 : ", Main.WIDTH/4 * 3,10, Color.BLUE,"Arial",16);
timer = new GUILabel(" ", Main.WIDTH/4 * 2,10, Color.BLACK,"Arial",16);
guis.add(p1);
guis.add(p2);

View file

@ -23,7 +23,9 @@ import globalgamejam.tiles.VaguesTile;
*/
public class MainWorld {
private ArrayList<Tile> tiles;
private ArrayList<Tile> arrierePlan;
private ArrayList<Tile> objetPlan;
private ArrayList<Tile> premierPlan;
private MainGame game;
@ -45,7 +47,9 @@ public class MainWorld {
public MainWorld(MainGame game){
this.game = game;
tiles = new ArrayList<>();
arrierePlan = new ArrayList<>();
objetPlan = new ArrayList<>();
premierPlan = new ArrayList<>();
listObjet = new ArrayList<>();
listMur = new ArrayList<>();
init();
@ -70,15 +74,15 @@ public class MainWorld {
this.mur1 = new Mur(Main.WIDTH/2,Main.HEIGHT-20,"res/textures/murmilieuhaut.png");
this.mur2 = new Mur(Main.WIDTH/2, Main.HEIGHT/2+30 ,"res/textures/murmilieumilieu.png");
this.mur3 = new Mur(Main.WIDTH/2, 100, "res/textures/murmilieubas.png");
tiles.add(fond);
arrierePlan.add(fond);
tiles.add(mur1.getTile());
tiles.add(mur2.getTile());
tiles.add(mur3.getTile());
tiles.add(murGauche.getTile());
tiles.add(murDroit.getTile());
tiles.add(murHaut.getTile());
tiles.add(murBas.getTile());
arrierePlan.add(mur1.getTile());
arrierePlan.add(mur2.getTile());
arrierePlan.add(mur3.getTile());
arrierePlan.add(murGauche.getTile());
arrierePlan.add(murDroit.getTile());
arrierePlan.add(murHaut.getTile());
arrierePlan.add(murBas.getTile());
@ -92,10 +96,10 @@ public class MainWorld {
listMur.add(murHaut);
listMur.add(murBas);
tiles.add(vagues);
premierPlan.add(vagues);
tiles.add(player1.getTile());
tiles.add(player2.getTile());
premierPlan.add(player1.getTile());
premierPlan.add(player2.getTile());
tempsEntreVague=0;
TempsAncienneVague=System.currentTimeMillis();
@ -255,7 +259,7 @@ public class MainWorld {
}
for(Objet o : listObjetADespawn){
this.tiles.remove(o.getTile());
this.objetPlan.remove(o.getTile());
this.listObjet.remove(o);
}
@ -312,13 +316,20 @@ public class MainWorld {
public void render(){
if(!Input.isKey(this.game.helpKey) && this.game.scores[0] > 0 && this.game.scores[1] > 0 && MainGame.time_in_sec > 0){
for(Tile t : tiles)t.render();
for(Tile t : arrierePlan)t.render();
for(Tile t : objetPlan)t.render();
for(Tile t : premierPlan)t.render();
}
}
public void destroy(){
for(Tile t : tiles)t.destroy();
tiles.clear();
for(Tile t : arrierePlan)t.destroy();
arrierePlan.clear();
for(Tile t : objetPlan)t.destroy();
objetPlan.clear();
for(Tile t : premierPlan)t.destroy();
premierPlan.clear();
}
public void genererBonusMalus(int nombre){
@ -329,7 +340,7 @@ public class MainWorld {
EObjetType type = types[(int)(Math.random() * types.length)];
Objet o = new Objet(type.getFilename(), (float)(Math.random() * (minHeight - minWidth)), 150, 0, 0, 5, 0.02f);
o.setType(type);
tiles.add(o.getTile());
objetPlan.add(o.getTile());
listObjet.add(o);
}
}