added groundwork for shell animation

This commit is contained in:
Yvonne Schmidt
2024-10-14 05:31:20 +02:00
parent 563784dbab
commit 47610d9e11
38 changed files with 776156 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ import com.jme3.scene.shape.Cylinder;
import pp.battleship.client.BattleshipApp;
import pp.battleship.model.Battleship;
import pp.battleship.model.Rotation;
import pp.battleship.model.Shell;
import pp.battleship.model.ShipMap;
import pp.battleship.model.Shot;
@@ -43,6 +44,7 @@ class SeaSynchronizer extends ShipMapSynchronizer {
private static final String SMALL_BOAT_MODEL = "Models/BoatSmall/12219_boat_v2_L2.j3o";
private static final String BATTLE_MODEL = "Models/Battle/Battle.j3o"; //NON-NLS
private static final String CV_MODEL = "Models/CV/CV.j3o"; //NON-NLS
private static final String SHELL_MODEL = "Models/Shell/45.j3o";
private static final String COLOR = "Color"; //NON-NLS
private static final String SHIP = "ship"; //NON-NLS
private static final String SHOT = "shot"; //NON-NLS
@@ -52,6 +54,8 @@ class SeaSynchronizer extends ShipMapSynchronizer {
private final ShipMap map;
private final BattleshipApp app;
private Shell shell;
private Spatial shellModel;
private ParticleEmitter flame, flash, spark, roundspark, smoketrail, debris,
shockwave;
@@ -318,6 +322,21 @@ class SeaSynchronizer extends ShipMapSynchronizer {
return waterSplash;
}
private void initiateShellFlight(Shot shot) {
Vector3f startPosition = new Vector3f(0, 1, 0); // The position where the shell starts, can be adjusted
Vector3f targetPosition = new Vector3f(shot.getX() + 0.5f, 0, shot.getY() + 0.5f);
shell = new Shell(startPosition, targetPosition, 2f); // 2 seconds flight duration
shellModel = app.getAssetManager().loadModel(SHELL_MODEL);
Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", ColorRGBA.Yellow);
shellModel.setMaterial(material);
// Set the initial position for the shell model
shellModel.setLocalTranslation(startPosition);
//.attachChild(shellModel); TODO
}
/**
* Constructs a {@code SeaSynchronizer} object with the specified application, root node, and ship map.
*

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB