From e2347fe0f118833d5d9ac3053ef016569c299946 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 21 Jan 2017 01:26:00 +0100 Subject: [PATCH] AjoutVague --- src/globalgamejam/game/MainGame.java | 63 ++++++++++++++++++++-------- src/globalgamejam/tiles/Objet.java | 8 +++- 2 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/globalgamejam/game/MainGame.java b/src/globalgamejam/game/MainGame.java index d7ed9b9..a3a7e76 100644 --- a/src/globalgamejam/game/MainGame.java +++ b/src/globalgamejam/game/MainGame.java @@ -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(); - 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 list = new ArrayList<>(); + if(hauteurMaxMIN_HAUTEUR_MAX && hauteurMaxMain.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