AjoutVague
This commit is contained in:
parent
780149da46
commit
e2347fe0f1
2 changed files with 52 additions and 19 deletions
|
@ -3,25 +3,21 @@ package globalgamejam.game;
|
|||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List;
|
||||
|
||||
import globalgamejam.Main;
|
||||
|
||||
import globalgamejam.math.Vector2f;
|
||||
|
||||
import globalgamejam.gui.ActionGUI;
|
||||
import globalgamejam.gui.GUI;
|
||||
import globalgamejam.gui.GUILabel;
|
||||
import globalgamejam.render.Camera;
|
||||
import globalgamejam.tiles.Fond;
|
||||
import globalgamejam.tiles.Objet;
|
||||
import globalgamejam.tiles.TestTile;
|
||||
import globalgamejam.tiles.Tile;
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
/**
|
||||
* Class created by MrDev023 (Florian RICHER) on 14/01/2017
|
||||
*/
|
||||
|
@ -45,13 +41,12 @@ public class MainGame extends Game{
|
|||
fond.getTransform().scale(Main.WIDTH,Main.HEIGHT, 0);
|
||||
fond.getTransform().rotate(180, 0, 0);
|
||||
guis = new ArrayList<GUI>();
|
||||
TestTile t = new TestTile();
|
||||
t.getTransform().translate(100,100,0);
|
||||
t.getTransform().scale(10,10,0);
|
||||
tiles.add(fond);
|
||||
tiles.add(t);
|
||||
|
||||
|
||||
tiles.add(fond);
|
||||
TestTile test = new TestTile();
|
||||
test.getTransform().translate(0, 80, 0);
|
||||
test.getTransform().scale(10, 10, 0);
|
||||
tiles.add(test);
|
||||
player1 = new Player(-100, 0);
|
||||
tiles.add(player1.getTile());
|
||||
|
||||
|
@ -72,7 +67,7 @@ public class MainGame extends Game{
|
|||
}
|
||||
});
|
||||
guis.add(label);
|
||||
|
||||
generateEntity(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,8 +97,42 @@ public class MainGame extends Game{
|
|||
guis.clear();
|
||||
}
|
||||
|
||||
public void generateEntity(){
|
||||
int nb =3;
|
||||
public void generateEntity(int nb){
|
||||
final int MIN_HAUTEUR_MAX=150;
|
||||
final int MIN_HAUTEUR=80;
|
||||
|
||||
|
||||
int hauteurMax = (int) (MIN_HAUTEUR_MAX +Math.random()* Main.HEIGHT-80);
|
||||
int nbMin = 0;
|
||||
int nbMax = 0;
|
||||
ArrayList<Tile> list = new ArrayList<>();
|
||||
if(hauteurMax<MIN_HAUTEUR_MAX){
|
||||
nbMin=nb-2;
|
||||
nbMax=0;
|
||||
}
|
||||
if(hauteurMax>MIN_HAUTEUR_MAX && hauteurMax<Main.HEIGHT/2){
|
||||
nbMin=nb-2;
|
||||
nbMax=nb+2;
|
||||
}
|
||||
if(hauteurMax>Main.HEIGHT/2){
|
||||
nbMin=0;
|
||||
nbMax=nb+2;
|
||||
}
|
||||
int countJ1=(int)(nbMin + Math.random()*nbMax);
|
||||
int countJ2=(int)(nbMin + Math.random()*nbMax);
|
||||
|
||||
for(int i =0;i<countJ1;i++){
|
||||
|
||||
list.add(new Objet((int)(Math.random()* Main.WIDTH/2),(int) (MIN_HAUTEUR+Math.random()* hauteurMax)));
|
||||
}
|
||||
|
||||
for(int i =0;i<countJ1;i++){
|
||||
|
||||
list.add(new Objet((int)(Main.WIDTH/2+Math.random()* Main.WIDTH),(int) (MIN_HAUTEUR +Math.random()* hauteurMax)));
|
||||
}
|
||||
|
||||
for(Tile t : list){
|
||||
tiles.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package globalgamejam.tiles;
|
||||
|
||||
import globalgamejam.math.Color4f;
|
||||
import globalgamejam.math.Vector2f;
|
||||
|
||||
public class Objet extends Tile {
|
||||
public Objet(){
|
||||
public Objet(int x,int y){
|
||||
super();
|
||||
super.setColor(Color4f.GREEN);
|
||||
super.setColor(Color4f.RED);
|
||||
super.setPosition(new Vector2f(x, y));
|
||||
super.setScale(new Vector2f(10, 10));
|
||||
super.applyTransform();
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue