fixed Icons; edited smoke particles; removed test code #43
@@ -14,7 +14,6 @@ implementation project(":mdga:model")
|
|||||||
implementation libs.jme3.desktop
|
implementation libs.jme3.desktop
|
||||||
implementation libs.jme3.effects
|
implementation libs.jme3.effects
|
||||||
|
|
||||||
|
|
||||||
runtimeOnly libs.jme3.awt.dialogs
|
runtimeOnly libs.jme3.awt.dialogs
|
||||||
runtimeOnly libs.jme3.plugins
|
runtimeOnly libs.jme3.plugins
|
||||||
runtimeOnly libs.jme3.jogg
|
runtimeOnly libs.jme3.jogg
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ private void setupInput() {
|
|||||||
inputManager.addListener(analogListener, "MouseLeft", "MouseRight", "MouseScrollUp", "MouseScrollDown");
|
inputManager.addListener(analogListener, "MouseLeft", "MouseRight", "MouseScrollUp", "MouseScrollDown");
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID p = null;
|
|
||||||
/**
|
/**
|
||||||
* Handles action-based input events such as key presses and mouse clicks.
|
* Handles action-based input events such as key presses and mouse clicks.
|
||||||
*/
|
*/
|
||||||
@@ -121,13 +120,9 @@ public void onAction(String name, boolean isPressed, float tpf) {
|
|||||||
if (diceSelect != null) {
|
if (diceSelect != null) {
|
||||||
app.getModelSynchronize().rolledDice();
|
app.getModelSynchronize().rolledDice();
|
||||||
} else if (cardLayerSelect != null) {
|
} else if (cardLayerSelect != null) {
|
||||||
//cardSelect
|
|
||||||
if (cardLayerSelect.isSelectable()) gameView.getGuiHandler().selectCard(cardLayerSelect);
|
if (cardLayerSelect.isSelectable()) gameView.getGuiHandler().selectCard(cardLayerSelect);
|
||||||
} else if (boardSelect != null) {
|
} else if (boardSelect != null) {
|
||||||
//boardSelect
|
|
||||||
if (boardSelect.isSelectable()) gameView.getBoardHandler().pieceSelect(boardSelect);
|
if (boardSelect.isSelectable()) gameView.getBoardHandler().pieceSelect(boardSelect);
|
||||||
} else {
|
|
||||||
//both null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,34 +134,9 @@ public void onAction(String name, boolean isPressed, float tpf) {
|
|||||||
if (name.equals("Right")) {
|
if (name.equals("Right")) {
|
||||||
isRotateRight = !isRotateRight;
|
isRotateRight = !isRotateRight;
|
||||||
}
|
}
|
||||||
if (name.equals("Test2") && isPressed) {
|
if (name.equals("Test") && isPressed) {
|
||||||
if (app.getView() instanceof GameView gameView) {
|
if (app.getView() instanceof GameView gameView) {
|
||||||
|
//Test Code
|
||||||
if (p == null) {
|
|
||||||
p = UUID.randomUUID();
|
|
||||||
gameView.getBoardHandler().addPlayer(Color.AIRFORCE, List.of(p, UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()));
|
|
||||||
gameView.getBoardHandler().movePieceStart(p, 0);
|
|
||||||
gameView.getBoardHandler().setSelectableMove(List.of(p), List.of(2), List.of(false));
|
|
||||||
//gameView.getBoardHandler().movePieceAnim(p,0, 8);
|
|
||||||
} else {
|
|
||||||
gameView.getBoardHandler().throwPiece(p, Color.ARMY);
|
|
||||||
//gameView.getBoardHandler().movePieceStartAnim(p,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// gameView.getGuiHandler().rollRankingResult(Color.AIRFORCE, 1);
|
|
||||||
// gameView.getGuiHandler().rollRankingResult(Color.ARMY, 2);
|
|
||||||
// gameView.getGuiHandler().rollRankingResult(Color.NAVY, 3);
|
|
||||||
// gameView.getGuiHandler().rollRankingResult(Color.CYBER, 4);
|
|
||||||
// gameView.getGuiHandler().showDice();
|
|
||||||
// UUID p1 = UUID.randomUUID();
|
|
||||||
|
|
||||||
// gameView.getBoardHandler().addPlayer(Color.AIRFORCE,List.of(p1,UUID.randomUUID(),UUID.randomUUID(),UUID.randomUUID()));
|
|
||||||
// gameView.getBoardHandler().movePieceStartAnim(p1,0);
|
|
||||||
//gameView.getGuiHandler().drawCard(Color.ARMY);
|
|
||||||
//gameView.getGuiHandler().addCardOwn(BonusCard.SHIELD);
|
|
||||||
//gameView.getGuiHandler().playCardOwn(BonusCard.SHIELD);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@@ -136,7 +137,9 @@ public static void main(String[] args) {
|
|||||||
app.setDisplayStatView(false);
|
app.setDisplayStatView(false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
settings.setIcons(new Image[]{ImageIO.read(new File("src/main/resources/Images/icon/icon128.png"))});
|
settings.setIcons(new BufferedImage[]{
|
||||||
|
ImageIO.read(Thread.currentThread().getContextClassLoader().getResourceAsStream("Images/icon/icon128.png"))
|
||||||
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ public class Explosion {
|
|||||||
|
|
||||||
private boolean triggered = false;
|
private boolean triggered = false;
|
||||||
|
|
||||||
private final Material mat;
|
private final Material fireMat;
|
||||||
|
private final Material smokeMat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the {@code Explosion} class.
|
* Constructor for the {@code Explosion} class.
|
||||||
@@ -38,8 +39,10 @@ public Explosion(MdgaApp app, Node rootNode, Vector3f location) {
|
|||||||
this.rootNode = rootNode;
|
this.rootNode = rootNode;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
|
|
||||||
this.mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
this.fireMat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/flame.png"));
|
this.smokeMat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||||
|
fireMat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/flame.png"));
|
||||||
|
smokeMat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/vapor_cloud.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,9 +51,10 @@ public Explosion(MdgaApp app, Node rootNode, Vector3f location) {
|
|||||||
*/
|
*/
|
||||||
private void initializeEmitter() {
|
private void initializeEmitter() {
|
||||||
fire = new ParticleEmitter("Effect", Type.Triangle, 50);
|
fire = new ParticleEmitter("Effect", Type.Triangle, 50);
|
||||||
fire.setMaterial(mat);
|
fire.setMaterial(fireMat);
|
||||||
fire.setImagesX(2);
|
fire.setImagesX(2);
|
||||||
fire.setImagesY(2);
|
fire.setImagesY(2);
|
||||||
|
fire.setSelectRandomImage(true);
|
||||||
fire.setStartColor(ColorRGBA.Yellow);
|
fire.setStartColor(ColorRGBA.Yellow);
|
||||||
fire.setEndColor(ColorRGBA.Red);
|
fire.setEndColor(ColorRGBA.Red);
|
||||||
fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f, 0.2f, 4f));
|
fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f, 0.2f, 4f));
|
||||||
@@ -65,12 +69,13 @@ private void initializeEmitter() {
|
|||||||
fire.setLocalTranslation(location);
|
fire.setLocalTranslation(location);
|
||||||
|
|
||||||
smoke = new ParticleEmitter("Effect2", Type.Triangle, 40);
|
smoke = new ParticleEmitter("Effect2", Type.Triangle, 40);
|
||||||
smoke.setMaterial(mat);
|
smoke.setMaterial(smokeMat);
|
||||||
smoke.setImagesX(3);
|
smoke.setImagesX(3);
|
||||||
smoke.setImagesY(3);
|
smoke.setImagesY(3);
|
||||||
smoke.setStartColor(ColorRGBA.DarkGray);
|
smoke.setSelectRandomImage(true);
|
||||||
smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
|
smoke.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.5f));
|
||||||
smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 0.0f, 0.7f));
|
smoke.setEndColor(new ColorRGBA(ColorRGBA.Black));
|
||||||
|
smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 0.0f, 1.5f));
|
||||||
smoke.getParticleInfluencer().setVelocityVariation(0.5f);
|
smoke.getParticleInfluencer().setVelocityVariation(0.5f);
|
||||||
smoke.setStartSize(0.8f);
|
smoke.setStartSize(0.8f);
|
||||||
smoke.setEndSize(1.5f);
|
smoke.setEndSize(1.5f);
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ public class Smoke {
|
|||||||
private final Node rootNode;
|
private final Node rootNode;
|
||||||
private final MdgaApp app;
|
private final MdgaApp app;
|
||||||
private final Vector3f location;
|
private final Vector3f location;
|
||||||
private ParticleEmitter fire;
|
|
||||||
private ParticleEmitter smoke;
|
private ParticleEmitter smoke;
|
||||||
|
|
||||||
private boolean triggered = false;
|
private boolean triggered = false;
|
||||||
@@ -43,31 +42,17 @@ public Smoke(MdgaApp app, Node rootNode, Vector3f location) {
|
|||||||
* Configures the fire and smoke emitters with appearance, behavior, and lifespan.
|
* Configures the fire and smoke emitters with appearance, behavior, and lifespan.
|
||||||
*/
|
*/
|
||||||
private void initializeEmitter() {
|
private void initializeEmitter() {
|
||||||
fire = new ParticleEmitter("Effect", ParticleMesh.Type.Triangle, 50);
|
smoke = new ParticleEmitter("Effect2", ParticleMesh.Type.Triangle, 50);
|
||||||
fire.setMaterial(mat);
|
|
||||||
fire.setStartColor(ColorRGBA.DarkGray);
|
|
||||||
fire.setEndColor(ColorRGBA.DarkGray);
|
|
||||||
fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f, 0.2f, 4f));
|
|
||||||
fire.getParticleInfluencer().setVelocityVariation(0.4f);
|
|
||||||
fire.setStartSize(0.7f);
|
|
||||||
fire.setEndSize(3.8f);
|
|
||||||
fire.setGravity(0, 0, -0.1f);
|
|
||||||
fire.setLowLife(0.5f);
|
|
||||||
fire.setHighLife(1.2f);
|
|
||||||
fire.setParticlesPerSec(0);
|
|
||||||
|
|
||||||
fire.setLocalTranslation(location);
|
|
||||||
|
|
||||||
smoke = new ParticleEmitter("Effect2", ParticleMesh.Type.Triangle, 40);
|
|
||||||
smoke.setMaterial(mat);
|
smoke.setMaterial(mat);
|
||||||
smoke.setImagesX(2);
|
smoke.setImagesX(3);
|
||||||
smoke.setImagesY(2);
|
smoke.setImagesY(3);
|
||||||
|
smoke.setSelectRandomImage(true);
|
||||||
smoke.setStartColor(ColorRGBA.DarkGray);
|
smoke.setStartColor(ColorRGBA.DarkGray);
|
||||||
smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
|
smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
|
||||||
smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 0.0f, 2f));
|
smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f, 0.2f, 4f));
|
||||||
smoke.getParticleInfluencer().setVelocityVariation(0.5f);
|
smoke.getParticleInfluencer().setVelocityVariation(0.5f);
|
||||||
smoke.setStartSize(0.5f);
|
smoke.setStartSize(0.7f);
|
||||||
smoke.setEndSize(1.5f);
|
smoke.setEndSize(3f);
|
||||||
smoke.setGravity(0, 0, -0.3f);
|
smoke.setGravity(0, 0, -0.3f);
|
||||||
smoke.setLowLife(1.2f);
|
smoke.setLowLife(1.2f);
|
||||||
smoke.setHighLife(2.5f);
|
smoke.setHighLife(2.5f);
|
||||||
@@ -88,25 +73,6 @@ public void trigger() {
|
|||||||
initializeEmitter();
|
initializeEmitter();
|
||||||
}
|
}
|
||||||
|
|
||||||
rootNode.attachChild(fire);
|
|
||||||
fire.emitAllParticles();
|
|
||||||
fire.addControl(new AbstractControl() {
|
|
||||||
private float elapsedTime = 0;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void controlUpdate(float tpf) {
|
|
||||||
elapsedTime += tpf;
|
|
||||||
if (elapsedTime > 10f) {
|
|
||||||
rootNode.detachChild(fire);
|
|
||||||
fire.removeControl(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
rootNode.attachChild(smoke);
|
rootNode.attachChild(smoke);
|
||||||
smoke.emitAllParticles();
|
smoke.emitAllParticles();
|
||||||
smoke.addControl(new AbstractControl() {
|
smoke.addControl(new AbstractControl() {
|
||||||
|
|||||||
Reference in New Issue
Block a user