mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Wakes still broken. Implemented dashed lines that track the progress of individual boats.
#implement #story[483]
This commit is contained in:
@@ -3,6 +3,7 @@ package seng302.models;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Arc;
|
||||
import javafx.scene.shape.ArcType;
|
||||
import javafx.scene.transform.Rotate;
|
||||
|
||||
/**
|
||||
* Created by CJIRWIN on 27/04/2017.
|
||||
@@ -10,36 +11,40 @@ import javafx.scene.shape.ArcType;
|
||||
class Wake extends Arc {
|
||||
|
||||
private static int VELOCITY_SCALE_FACTOR = 3;
|
||||
private static int MAX_LIFESPAN = 420;
|
||||
private static int MAX_LIFESPAN = 210;
|
||||
private static double LIFESPAN_PER_FRAME = 1.0 / MAX_LIFESPAN;
|
||||
//private static double LENGTH_PER_FRAME = 120 / MAX_LIFESPAN;
|
||||
private static double LENGTH_PER_FRAME = 0.08;
|
||||
private static double LENGTH_PER_FRAME = 0.25;
|
||||
|
||||
private double velocityX;
|
||||
private double velocityY;
|
||||
private double opacity;
|
||||
private int lifespan = MAX_LIFESPAN;
|
||||
|
||||
Wake (double startingX, double startingY, double velocityX, double velocityY) {
|
||||
super(0, 0, 20, 30, 180, 0);
|
||||
Wake (double startingX, double startingY, double velocityX, double velocityY, double rotation) {
|
||||
super(startingX + 20, startingY + 30, 20, 30, 180, 0);
|
||||
//super.setFill(Color.BLUE);
|
||||
super.setStroke(Color.BLUE);
|
||||
super.setStroke(Color.DEEPSKYBLUE);
|
||||
super.setType(ArcType.OPEN);
|
||||
super.setFill(new Color(0, 0, 0 ,0));
|
||||
super.setStrokeWidth(2.0);
|
||||
this.velocityX = -velocityX / 2;
|
||||
this.velocityY = -velocityY / 2;
|
||||
super.getTransforms().add(new Rotate(rotation - 270, startingX + 20, startingY + 20));
|
||||
// this.velocityX = -velocityX;
|
||||
// this.velocityY = -velocityY;
|
||||
this.velocityX = 0;
|
||||
this.velocityY = 0;
|
||||
}
|
||||
|
||||
boolean updatePosition (double timeInterval) {
|
||||
lifespan--;
|
||||
//super.setOpacity(LIFESPAN_PER_FRAME * lifespan * super.getOpacity());
|
||||
opacity = LIFESPAN_PER_FRAME * lifespan * opacity;
|
||||
super.setFill(new Color(0.0f, 0.0f, 1.0f, opacity));
|
||||
//opacity = LIFESPAN_PER_FRAME * lifespan * opacity;
|
||||
//super.setFill(new Color(0.0f, 0.0f, 1.0f, opacity));
|
||||
super.setLayoutX(super.getLayoutX() + velocityX * timeInterval);
|
||||
super.setLayoutY(super.getLayoutY() + velocityY * timeInterval);
|
||||
super.setStartAngle(super.getStartAngle() - LENGTH_PER_FRAME);
|
||||
super.setLength(super.getLength() + LENGTH_PER_FRAME * 2);
|
||||
return lifespan == 0;
|
||||
return lifespan < 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user