Skip to content

Commit

Permalink
Merge branch 'master' into serial
Browse files Browse the repository at this point in the history
  • Loading branch information
aehmttw authored Nov 24, 2024
2 parents 2ec8dba + d0b6c58 commit e18b8a3
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 446 deletions.
2 changes: 1 addition & 1 deletion src/main/java/tanks/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ public static void initScript()
registerObstacle(ObstacleMud.class, "mud");
registerObstacle(ObstacleIce.class, "ice");
registerObstacle(ObstacleSnow.class, "snow");
registerObstacle(ObstacleLava.class, "lava");
// registerObstacle(ObstacleLava.class, "lava");
registerObstacle(ObstacleBoostPanel.class, "boostpanel");
registerObstacle(ObstacleTeleporter.class, "teleporter");
registerObstacle(ObstacleBeatBlock.class, "beat");
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/tanks/bullet/BulletArc.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class BulletArc extends Bullet
@Property(id = "min_range", minValue = 0.0, name = "Minimum range", category = BulletPropertyCategory.firing, desc = "The minimum distance this bullet may land from the tank that fired it \n \n 1 tile = 50 units")
public double minRange = 0;

@Property(id = "max_range", minValue = 0.0, name = "Maximum range", category = BulletPropertyCategory.firing, desc = "The maximum distance this bullet may land from the tank that fired it \n \n 1 tile = 50 units")
@Property(id = "max_range", minValue = 0.0, name = "Maximum range", category = BulletPropertyCategory.firing, desc = "The maximum distance this bullet may land from the tank that fired it. Set to 0 for unlimited. \n \n 1 tile = 50 units")
public double maxRange = 0;

@Property(id = "accuracy_spread_circle", minValue = 0.0, name = "Landing accuracy spread", category = BulletPropertyCategory.firing, desc = "The maximum distance between the target aim location and where the bullet actually lands, relative to the distance traveled by the bullet. Larger values are less accurate. \n \n A value of 1 corresponds to the bullet landing off by up to one tile per tile traveled.")
Expand Down Expand Up @@ -66,6 +66,7 @@ public void update()
double gravMod = this.getAttributeValue(AttributeModifier.velocity, 1);

this.vZ -= gravity * Panel.frameFrequency * gravMod;
this.posZ -= gravity * gravMod * Panel.frameFrequency * Panel.frameFrequency * 0.5;

if (this.posZ < Game.tile_size / 2 && !this.destroy)
{
Expand Down Expand Up @@ -155,7 +156,6 @@ public void setTargetLocation(double x, double y)
double dx = x - this.posX;
double dy = y - this.posY;
double d = Math.sqrt(dx * dx + dy * dy);
double offset = Math.random() * this.accuracySpreadCircle * d;
double s = Math.abs(this.speed);

if (d > this.maxRange && this.maxRange > 0)
Expand All @@ -172,6 +172,8 @@ public void setTargetLocation(double x, double y)
d = this.minRange;
}

double offset = Math.random() * this.accuracySpreadCircle * d;

double f = 1;
if (d / s < this.minAirTime)
f = d / (s * this.minAirTime);
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/tanks/gui/screen/ScreenChangelog.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,20 @@ public static void setupLogs()
}
);

new Changelog("v1.6.a", new String[]
{
"*What's new in Tanks v1.6.a:\n\n" +
"Added an enormous number of new bullet options\n" +
"Improved item editor\n" +
"Improved the tank editor for spawned and transformed tanks\n" +
"Level editor menu UI improvements\n" +
"Added beat blocks\n" +
"Made fireworks prettier and more performant\n" +
"Updated music\n" +
"Added third color for players\n" +
"Bug fixes and other minor improvements\n"
}
);
}
}
}
41 changes: 29 additions & 12 deletions src/main/java/tanks/gui/screen/ScreenDebug.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import tanks.Drawing;
import tanks.Game;
import tanks.gui.Button;
import tanks.tank.TankPlayer;

public class ScreenDebug extends Screen
{
Expand All @@ -12,6 +13,7 @@ public class ScreenDebug extends Screen
public String tankIDsText = "Show tank IDs: ";
public String invulnerableText = "Invulnerable: ";
public String fancyLightsText = "Fancy lighting: ";
public String destroyCheatText = "Destroy cheat: ";

public ScreenDebug()
{
Expand Down Expand Up @@ -47,25 +49,24 @@ public ScreenDebug()
fancyLighting.setText(fancyLightsText, ScreenOptions.onText);
else
fancyLighting.setText(fancyLightsText, ScreenOptions.offText);

if (TankPlayer.enableDestroyCheat)
destroyCheat.setText(destroyCheatText, ScreenOptions.onText);
else
destroyCheat.setText(destroyCheatText, ScreenOptions.offText);
}

Button back = new Button(Drawing.drawing.interfaceSizeX / 2, Drawing.drawing.interfaceSizeY / 2 + 210, this.objWidth, this.objHeight, "Back", () -> Game.screen = new ScreenTitle()
);
Button back = new Button(Drawing.drawing.interfaceSizeX / 2, Drawing.drawing.interfaceSizeY / 2 + 210, this.objWidth, this.objHeight, "Back", () -> Game.screen = new ScreenTitle());

Button keyboardTest = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 - this.objYSpace * 2, this.objWidth, this.objHeight, "Test keyboard", () -> Game.screen = new ScreenTestKeyboard()
);
Button keyboardTest = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 - this.objYSpace * 2.5, this.objWidth, this.objHeight, "Test keyboard", () -> Game.screen = new ScreenTestKeyboard());

Button textboxTest = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 - this.objYSpace * 1, this.objWidth, this.objHeight, "Test text boxes", () -> Game.screen = new ScreenTestTextbox()
);
Button textboxTest = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 - this.objYSpace * 1.5, this.objWidth, this.objHeight, "Test text boxes", () -> Game.screen = new ScreenTestTextbox());

Button modelTest = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 + this.objYSpace * 0, this.objWidth, this.objHeight, "Test models", () -> Game.screen = new ScreenTestModel(Drawing.drawing.createModel("/models/tankcamoflauge/base/"))
);
Button modelTest = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 - this.objYSpace * 0.5, this.objWidth, this.objHeight, "Test models", () -> Game.screen = new ScreenTestModel(Drawing.drawing.createModel("/models/tankcamoflauge/base/")));

Button fontTest = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 + this.objYSpace * 1, this.objWidth, this.objHeight, "Test fonts", () -> Game.screen = new ScreenTestFonts()
);
Button fontTest = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 + this.objYSpace * 0.5, this.objWidth, this.objHeight, "Test fonts", () -> Game.screen = new ScreenTestFonts());

Button fireworks = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 + this.objYSpace * 2, this.objWidth, this.objHeight, "Test fireworks", () -> Game.screen = new ScreenTestFireworks()
);
Button fireworks = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 + this.objYSpace * 1.5, this.objWidth, this.objHeight, "Test fireworks", () -> Game.screen = new ScreenTestFireworks());

Button traceAllRays = new Button(Drawing.drawing.interfaceSizeX / 2 + this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 + this.objYSpace * -2.5, this.objWidth, this.objHeight, "", new Runnable()
{
Expand Down Expand Up @@ -151,6 +152,20 @@ public void run()
}
});

Button destroyCheat = new Button(Drawing.drawing.interfaceSizeX / 2 - this.objXSpace / 2, Drawing.drawing.interfaceSizeY / 2 + this.objYSpace * 2.5, this.objWidth, this.objHeight, "", new Runnable()
{
@Override
public void run()
{
TankPlayer.enableDestroyCheat = !TankPlayer.enableDestroyCheat;

if (TankPlayer.enableDestroyCheat)
destroyCheat.setText(destroyCheatText, ScreenOptions.onText);
else
destroyCheat.setText(destroyCheatText, ScreenOptions.offText);
}
});



@Override
Expand All @@ -167,6 +182,7 @@ public void update()
tankIDs.update();
fancyLighting.update();
fireworks.update();
destroyCheat.update();
back.update();
}

Expand All @@ -189,6 +205,7 @@ public void draw()
fontTest.draw();
fancyLighting.draw();
fireworks.draw();
destroyCheat.draw();
back.draw();
}
}
Loading

0 comments on commit e18b8a3

Please sign in to comment.