Ver Fonte

Projectile testing

Tankernn há 8 anos atrás
pai
commit
e68d9f9b39
1 ficheiros alterados com 37 adições e 24 exclusões
  1. 37 24
      src/main/java/eu/tankernn/game/Game.java

+ 37 - 24
src/main/java/eu/tankernn/game/Game.java

@@ -7,6 +7,7 @@ import static eu.tankernn.game.Settings.TEXTURE_FILES;
 
 import java.io.FileNotFoundException;
 
+import org.lwjgl.input.Keyboard;
 import org.lwjgl.util.vector.Vector3f;
 
 import eu.tankernn.gameEngine.GameLauncher;
@@ -30,19 +31,21 @@ import eu.tankernn.gameEngine.util.MousePicker;
 
 public class Game extends TankernnGame3D {
 	public Game() {
-		super(Settings.GAME_NAME, TEXTURE_FILES, NIGHT_TEXTURE_FILES, new Light(new Vector3f(1, 1000, 1000), new Vector3f(1f, 1f, 1f)));
-		
+		super(Settings.GAME_NAME, TEXTURE_FILES, NIGHT_TEXTURE_FILES,
+				new Light(new Vector3f(1, 1000, 1000), new Vector3f(1f, 1f, 1f)));
+
 		try {
 			setupTerrain();
 		} catch (FileNotFoundException e) {
 			e.printStackTrace();
 		}
-		
-		player = new Player(loader.getModel(0), new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), 1, loader.getBoundingBox(loader.getModel(0).getModel().id), terrainPack);
-		
+
+		player = new Player(loader.getModel(0), new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), 1,
+				loader.getBoundingBox(loader.getModel(0).getModel().id), terrainPack);
+
 		entities.add(player);
 		camera = new PlayerCamera(player, terrainPack);
-		
+
 		renderer = new MasterRenderer(loader, camera, sky);
 		try {
 			waterMaster = new WaterMaster(loader, loader.loadTexture(DUDV_MAP), loader.loadTexture(NORMAL_MAP), camera);
@@ -51,39 +54,34 @@ public class Game extends TankernnGame3D {
 			e.printStackTrace();
 		}
 		particleMaster = new ParticleMaster(loader, camera.getProjectionMatrix());
-		try {
-			ParticleSystem system = new ParticleSystem(new ParticleTexture(Texture.newTexture(new InternalFile("particles/particleAtlas.png")).create(), 4, false), 10, 20, 1, 2);
-			system.setPosition(new Vector3f(10, 10, 10));
-			particleMaster.addSystem(system);
-		} catch (FileNotFoundException e) {
-			e.printStackTrace();
-		}
-		
-		entities.add(new Entity3D(loader.getModel(2), new Vector3f(10, 10, 10), new Vector3f(0, 0, 0), 1, loader.getBoundingBox(loader.getModel(2).getModel().id)));
-		
-		entities.add(new Entity3D(loader.getModel(3), new Vector3f(10, 10, 10), new Vector3f(0, 0, 0), 1, loader.getBoundingBox(loader.getModel(3).getModel().id)));
-		
+
+		entities.add(new Entity3D(loader.getModel(2), new Vector3f(10, 10, 10), new Vector3f(0, 0, 0), 1,
+				loader.getBoundingBox(loader.getModel(2).getModel().id)));
+
+		entities.add(new Entity3D(loader.getModel(3), new Vector3f(10, 10, 10), new Vector3f(0, 0, 0), 1,
+				loader.getBoundingBox(loader.getModel(3).getModel().id)));
+
 		postProcessor = new PostProcessor(loader);
 		picker = new MousePicker(camera, camera.getProjectionMatrix(), entities, guiMaster.getGuis());
 	}
-	
+
 	private void setupTerrain() throws FileNotFoundException {
 		Texture backgroundTexture = loader.loadTexture("textures/grassy.png");
 		Texture rTexture = loader.loadTexture("textures/dirt.png");
 		Texture gTexture = loader.loadTexture("textures/pinkFlowers.png");
 		Texture bTexture = loader.loadTexture("textures/path.png");
-		
+
 		TerrainTexturePack texturePack = new TerrainTexturePack(backgroundTexture, rTexture, gTexture, bTexture);
 		Texture blendMap = loader.loadTexture("textures/blendMap.png");
-		
+
 		terrainPack = new TerrainPack(loader, texturePack, blendMap, 1235);
 	}
-	
+
 	private void setupWater() {
 		WaterTile water = new WaterTile(50, 50, 0, 50);
 		waterMaster.addWaterTile(water);
 	}
-	
+
 	public void update() {
 		super.update();
 		if (waterMaster.isPointUnderWater(camera.getPosition()) && postProcessor.blurFactor < 2)
@@ -98,8 +96,23 @@ public class Game extends TankernnGame3D {
 				e.setScale(2);
 			else
 				e.setScale(1);
+		if (Keyboard.isKeyDown(Keyboard.KEY_E)) {
+			try {
+				ParticleSystem system = new ParticleSystem(
+						new ParticleTexture(Texture.newTexture(new InternalFile("particles/fire.png")).create(), 8,
+								false),
+						10, 2, 0.1f, 2);
+				system.setPosition(new Vector3f(0, 0,0));
+				particleMaster.addSystem(system);
+				
+//				Projectile p = new BasicProjectile(loader.getModel(1), new Vector3f(player.getPosition()), new Vector3f(1, 0, 1), system);
+//				entities.add(p);
+			} catch (FileNotFoundException e) {
+				e.printStackTrace();
+			}
+		}
 	}
-	
+
 	public static void main(String[] args) {
 		GameLauncher.init(Settings.GAME_NAME, 1600, 900);
 		GameLauncher.launch(new Game());