Fixed sails so they behave correctly
- Changed sail angle calculations back - Luffing currently displays no sail as a temporary representation of sails in #story[1098]
This commit is contained in:
@@ -328,31 +328,29 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
double sailRotateAngle; // required rotation for correct sail display
|
||||
Image sailImage;
|
||||
|
||||
gc.save();
|
||||
// right half of points of sail
|
||||
if (boatBearing < 180) {
|
||||
sailImage = sailsRight;
|
||||
sailRotateAngle = boatBearing; // math
|
||||
xPos -= 1; // right align to boat edge on canvas
|
||||
// System.out.println("right side -- boat: " + boatBearing +
|
||||
// "|| rotate: " + sailRotateAngle);
|
||||
}
|
||||
// left half of points of sail
|
||||
else {
|
||||
sailImage = sailsLeft;
|
||||
sailRotateAngle = -(360 - boatBearing); // math
|
||||
xPos -= 5; // left align to boat edge on canvas
|
||||
// System.out.println("left side -- boat: " + boatBearing +
|
||||
// "|| rotate: " + sailRotateAngle);
|
||||
}
|
||||
// remove when method is finished
|
||||
sailRotateAngle = 0;
|
||||
sailImage = null;
|
||||
|
||||
// Change the angle of the sail if the sail is out
|
||||
gc.save();
|
||||
if (ThisBoat.getInstance().isSailsOut()) {
|
||||
if (boatBearing < 180) {
|
||||
sailRotateAngle -= 90;
|
||||
} else {
|
||||
sailRotateAngle += 90;
|
||||
if (boatBearing < 180) { // right half of points of sail
|
||||
sailImage = sailsRight;
|
||||
sailRotateAngle = boatBearing * 0.5; // math
|
||||
xPos -= 1; // right align to boat edge on canvas
|
||||
// System.out.println("right side -- boat: " + boatBearing +
|
||||
// "|| rotate: " + sailRotateAngle);
|
||||
}
|
||||
else { // left half of points of sail
|
||||
sailImage = sailsLeft;
|
||||
sailRotateAngle = -(360 - boatBearing) * 0.5; // math
|
||||
xPos -= 5; // left align to boat edge on canvas
|
||||
// System.out.println("left side -- boat: " + boatBearing +
|
||||
// "|| rotate: " + sailRotateAngle);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// TODO: display luffing sail
|
||||
}
|
||||
|
||||
// rotate sails based on boats current heading
|
||||
|
||||
Reference in New Issue
Block a user