edited the fire, adjusted the rocket_size,added the models in j3o files, adjusted the Gamesound, added the artefacts
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#
|
||||
# Specifies the map used by the opponent in single mode.
|
||||
# Single mode is activated if this property is set.
|
||||
#map.opponent=maps/map2.json
|
||||
map.opponent=maps/map2.json
|
||||
#
|
||||
# Specifies the map used by the player in single mode.
|
||||
# The player must define their own map if this property is not set.
|
||||
|
||||
@@ -124,6 +124,11 @@ public void shipDestroyed() {
|
||||
shipDestroyedSound.playInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* when triggered, though a sound-event,it decides, which sound should be played
|
||||
*
|
||||
* @param event the received event
|
||||
*/
|
||||
@Override
|
||||
public void receivedEvent(SoundEvent event) {
|
||||
switch (event.sound()) {
|
||||
@@ -140,7 +145,7 @@ public void receivedEvent(SoundEvent event) {
|
||||
*/
|
||||
private void rocket() {
|
||||
if (isEnabled() && splashSound != null)
|
||||
rocketSound.playInstance();
|
||||
rocketSound.play();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,17 +43,14 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
|
||||
private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS
|
||||
private static final String KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o"; //NON-NLS
|
||||
private static final String SUBMARINE = "Models/Submarine/submarine.obj";
|
||||
private static final String DESTROYER = "Models/Destroyer/10619_Battleship.obj";
|
||||
private static final String SUBMARINE = "Models/Submarine/submarine.j3o";
|
||||
private static final String DESTROYER = "Models/Destroyer/10619_Battleship.j3o";
|
||||
private static final String SMALL_SHIP = "Models/SmallShip/10634_SpeedBoat_v01_LOD3.obj";
|
||||
private static final String PARTICLE = "Common/MatDefs/Misc/Particle.j3md";
|
||||
private static final String COLOR = "Color"; //NON-NLS
|
||||
private static final String SHIP = "ship"; //NON-NLS
|
||||
private static final String SHOT = "shot"; //NON-NLS
|
||||
private static final String ROCKET = "Models/Rocket/rocket.j3o";
|
||||
private static final ColorRGBA BOX_COLOR = ColorRGBA.Gray;
|
||||
private static final ColorRGBA SPLASH_COLOR = new ColorRGBA(0f, 0f, 1f, 0.4f);
|
||||
private static final ColorRGBA HIT_COLOR = new ColorRGBA(1f, 0f, 0f, 0.4f);
|
||||
|
||||
private final ShipMap map;
|
||||
private final BattleshipApp app;
|
||||
@@ -123,27 +120,28 @@ private Spatial handleHit(Shot shot) {
|
||||
* @param shot the shot, that hit the ship
|
||||
* @return the Fire
|
||||
*/
|
||||
|
||||
private ParticleEmitter createFire(Shot shot) {
|
||||
ParticleEmitter hitEffect = new ParticleEmitter("HitEffect", Type.Triangle, 5000);
|
||||
ParticleEmitter hitEffect = new ParticleEmitter("fire", Type.Triangle, 5000);
|
||||
hitEffect.setMaterial(new Material(app.getAssetManager(), PARTICLE));
|
||||
hitEffect.setImagesX(2);
|
||||
hitEffect.setImagesY(2);
|
||||
hitEffect.setStartColor(ColorRGBA.Orange);
|
||||
hitEffect.setEndColor(ColorRGBA.Red);
|
||||
hitEffect.setStartSize(0.1f);
|
||||
hitEffect.setEndSize(0.1f);
|
||||
hitEffect.setParticlesPerSec(2);
|
||||
hitEffect.setEndSize(0.05f);
|
||||
hitEffect.getParticleInfluencer().setInitialVelocity(new Vector3f(0,1,0));
|
||||
hitEffect.setParticlesPerSec(5);
|
||||
hitEffect.setLowLife(1f);
|
||||
hitEffect.setHighLife(1f);
|
||||
final Node shipNode = requireNonNull((Node) getSpatial(map.findShipAt(shot.getX(), shot.getY())), "Missing ship node");
|
||||
hitEffect.setGravity(0, -0.9f, 0);
|
||||
Vector3f shipNodePos = shipNode.getLocalTranslation();
|
||||
Vector3f shotWorld = mapToWorldCord(shot.getX(), shot.getY());
|
||||
Vector3f firePos = shotWorld.subtract(shipNodePos);
|
||||
if (map.findShipAt(shot.getX(), shot.getY()).getLength() == 2) {
|
||||
hitEffect.setLocalTranslation(firePos.x, 0.25f, firePos.z);
|
||||
hitEffect.setLocalTranslation(firePos.x, 0.15f, firePos.z);
|
||||
} else {
|
||||
hitEffect.setLocalTranslation(firePos.x, 0.5f, firePos.z);
|
||||
hitEffect.setLocalTranslation(firePos.x, 0.3f, firePos.z);
|
||||
}
|
||||
return hitEffect;
|
||||
}
|
||||
@@ -262,7 +260,7 @@ private Spatial createShell() {
|
||||
LOGGER.log(Level.INFO, "created Shell");
|
||||
final Spatial model = app.getAssetManager().loadModel(ROCKET);
|
||||
model.rotate(PI, PI, 0);
|
||||
model.scale(0.0005f);
|
||||
model.scale(0.0002f);
|
||||
model.move(0, 0, 0);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
return model;
|
||||
|
||||
@@ -94,13 +94,17 @@ public ShipControl(Battleship ship, ShipMap map) {
|
||||
protected void controlUpdate(float tpf) {
|
||||
// If spatial is null, do nothing
|
||||
if (spatial == null) return;
|
||||
if (ship.isDestroyed() && spatial.getLocalTranslation().getY() < SINKING_HEIGHT) { // removes the ship, if it is completely sunk
|
||||
spatial.getParent().detachChild(spatial);
|
||||
}
|
||||
else if (ship.isDestroyed() && spatial.getLocalTranslation().getY() >= SINKING_HEIGHT) { // sink the ship, if it's not completely sunk
|
||||
spatial.move(0, tpf * 0.1f * -1, 0);
|
||||
if(ship.isDestroyed()){
|
||||
if(spatial.getLocalTranslation().getY() < SINKING_HEIGHT) { // removes the ship, if it is completely sunk
|
||||
spatial.getParent().detachChild(spatial);
|
||||
}
|
||||
else // sink the ship, if it's not completely sunk
|
||||
spatial.move(0, tpf * 0.1f * -1, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Update the time within the oscillation cycle
|
||||
time = (time + tpf) % cycle;
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,7 +41,7 @@ public static void main(String[] args) {
|
||||
*/
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o"); //NON-NLS
|
||||
export("Models/KingGeorgeV/rocket/proton.obj", "proton.j3o"); //NON-NLS
|
||||
|
||||
stop();
|
||||
}
|
||||
|
||||
@@ -11,10 +11,9 @@ public class Shell implements Item {
|
||||
private static final Logger LOGGER = System.getLogger(Shell.class.getName());
|
||||
|
||||
/**
|
||||
* the Target, the Shell will hit, displayed through: x,y
|
||||
* the Target, the Shell will hit
|
||||
*/
|
||||
private int x;
|
||||
private int y;
|
||||
private IntPoint target;
|
||||
|
||||
/**
|
||||
* the constructor for this class
|
||||
@@ -22,8 +21,7 @@ public class Shell implements Item {
|
||||
* @param target the target, the shell is fired at
|
||||
*/
|
||||
public Shell(IntPoint target) {
|
||||
this.x = target.getX();
|
||||
this.y = target.getY();
|
||||
this.target = target;
|
||||
LOGGER.log(Level.INFO, "Shell has been initialized");
|
||||
}
|
||||
|
||||
@@ -49,14 +47,13 @@ public void accept(VoidVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getter for the x coordinate
|
||||
*
|
||||
* @return int x coordinate
|
||||
*/
|
||||
public int getX() {
|
||||
return x;
|
||||
return target.getX();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,24 +62,6 @@ public int getX() {
|
||||
* @return int y coordinate
|
||||
*/
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter for x coordinate
|
||||
*
|
||||
* @param x the new value of x coordinate
|
||||
*/
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter for y coordinate
|
||||
*
|
||||
* @param y the new value of y coordinate
|
||||
*/
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
return target.getY();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user