Skip to content

Commit

Permalink
Tanks v0.9.0 - new mud and ice tiles, shield item, crusade editor and…
Browse files Browse the repository at this point in the history
… improvements, party, level editor, and UI improvements, new sounds and music, and more.
  • Loading branch information
aehmttw committed Sep 13, 2020
1 parent 88022c8 commit 4ce8a89
Show file tree
Hide file tree
Showing 78 changed files with 2,387 additions and 361 deletions.
49 changes: 45 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
Karan: this is a changelog. mateusz, please put all of your version names and things in here, not in commit messages. if your commit messages say anything about a version... they shouldn't

Hallowizer: Yes, I agree.
It’s update time! Tanks v0.9.0 is finally out, a pretty big update focused mainly on improvements all around! Here’s what’s new:<br>

New gameplay elements<br>
-a shield item that allows your tank to take extra hits<br>
-mud tiles that slow tanks down<br>
-slippery ice tiles

Crusade improvements<br>
-a crusade editor that lets you create custom items too<br>
-new crusade details screen, allows you to resume or start over<br>
-save progress for multiple crusades at once

Party improvements<br>
-share levels in parties<br>
-anti-cheat added (can be turned off in options)<br>
-change your tank color in parties<br>
-improved the experience for high latency players<br>
-new party ready screen

Level editor improvements<br>
-select and fill multiple tiles at once<br>
-stagger block height easily to make castle style walls<br>
-button shortcuts now have info text

Hallowizer: I may or may not have done something.
Improvements to UI<br>
-change controls from the input options menu<br>
-when in a large level, the camera has a short delay in following the player<br>
-after being destroyed, you can click a tank to spectate it<br>
-new tutorial<br>
-button and textbox shadows for super graphics<br>
-level names are now displayed with spaces instead of underscores<br>
-info text background improved<br>
-shop buttons now show icon and price

Sound and music<br>
-new music tracks for the party ready screen (before and after clicking ready), and for the options screens<br>
-new sound effects<br>
-sound options screen lets you toggle sound and music

More<br>
-tank hitboxes are now slightly smaller to make 1-block gaps easier to enter<br>
-computer-controlled tanks now control their acceleration, not velocity<br>
-so many various improvements and bug fixes

Next stop: v1.0.0!

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018 Matei Budiu, Karan Gurazada, Hallowizer
Copyright 2018 Matei Budiu, Karan Gurazada, Hallowizer, Grify

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
58 changes: 28 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
# Tanks

Tanks is a game written in Java inspired by a minigame of the same name on the Wii game "Wii Play".
There are 18 unique enemies you can fight, but you can add more of your own too.
Tanks is a game written in Java inspired by a game of the same name on the Wii.
There are 13 unique enemies you can fight, but you can add more of your own too.
The game works in Windows, Mac or Linux.

Here is a technical demonstration video of Tanks: https://www.youtube.com/embed/iv6r5ioHpTc

## How to play

Controls: <br>
Use the arrow keys or WASD to move<br>
Left click or click space to shoot<br>
Right click or press enter to lay a mine<br>
Press escape to pause the game<br>
Controls:
Use the arrow keys or WASD to move
Left click or click space to shoot
Right click or press enter to lay a mine
Press escape to pause the game

Level Editor controls:<br>
Left click to place<br>
Right click on an object to destroy it<br>
Right click on nothing to rotate the object you are placing<br>
Press up and down arrow keys or scroll to cycle enemy tanks<br>
Press left and right arrow keys to cycle enemy tank, obstacle, player tank<br><br>
Level Editor controls:
Left click to place
Right click on an object to destroy it
Right click on nothing to rotate the object you are placing
Press up and down arrow keys or scroll to cycle enemy main.java.tanks
Press left and right arrow keys to cycle enemy tank, obstacle, player tank

The following are three screenshots of the game in action. The colored squares are
tanks belonging to different teams, firing at each other. The brown squares are
main.java.tanks belonging to different teams, firing at each other. The brown squares are
obstacles. The user controls the cyan tank using the mouse or keyboard.

![Gameplay](screenshot1.PNG)
Expand All @@ -35,7 +33,7 @@ To use the game you need to install Java. For this purpose you may need
administrator privileges to install software on your machine. You can install java
from [java.com](https://java.com/download).

You can download the [jar files](https://1drv.ms/u/s!AnwBrt306BrJ-ltbmsJuG2pZdfVk?e=dNsY3z) for current and past versions of Tanks (Choose this if you want to play the game but not modify its code).
You can download the [jar file](https://1drv.ms/u/s!AnwBrt306BrJ6TlP255XMw8D8VGY) for main.java.tanks.
This comes as a zip, extract the zip file and you will have the jar file and a run command for mac.
To run the jar file on Windows you can double-click on it. For Mac, you need to run the jar file with the
argument -XstartOnFirstThread, or by using the file whose name starts with RunTanks.
Expand All @@ -44,23 +42,23 @@ argument -XstartOnFirstThread, or by using the file whose name starts with RunTa

To develop the game we suggest using Eclipse or IntelliJ. Eclipse can be installed from
[eclipse.org](http://www.eclipse.org/downloads/). IntelliJ can be installed from
[jetbrains.com](https://www.jetbrains.com/idea/download/)<br>
[jetbrains.com](https://www.jetbrains.com/idea/download/)

To access the source code you also need to install git.<br>
To access the source code you also need to install git.

You will need to add the following libraries to the build path of the project: <br>
PNGDecoder by Matthias Mann in TWL<br>
All the jars and natives of the following LWJGL libraries:<br>
LWJGL (core)<br>
OpenGL<br>
OpenAL<br>
GLFW<br>
Assimp<br>
STB<br>
Commons IO<br>
You will need to add the following libraries to the build path of the project:
PNGDecoder by Matthias Mann in TWL
All the jars and natives of the following LWJGL libraries:
LWJGL (core)
OpenGL
OpenAL
GLFW
Assimp
STB

## Credits:

Matei Budiu (Aehmttw)<br>
Karan Gurazada<br>
Hallowizer
Hallowizer<br>
Grify
Binary file modified screenshot1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 6 additions & 15 deletions src/main/java/swingwindow/SwingPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import swingwindow.input.InputMouse;
import swingwindow.input.InputScroll;
import tanks.Game;

import javax.swing.*;
import java.awt.*;
Expand All @@ -28,24 +27,16 @@ public SwingPanel(SwingWindow w)
@Override
public void actionPerformed(ActionEvent e)
{
try
{
w.startTiming();
w.startTiming();

w.absoluteWidth = getWidth();
w.absoluteHeight = getHeight();
w.absoluteWidth = getWidth();
w.absoluteHeight = getHeight();

w.updater.update();
w.updater.update();

repaint();

w.stopTiming();
}
catch (Exception exception)
{
Game.exitToCrash(exception);
}
repaint();

w.stopTiming();
}

});
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/swingwindow/SwingWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void applyTransformations()
@Override
public void loadPerspective()
{
throw new UnsupportedOperationException("The Swing renderer does not support 3D!");
//throw new UnsupportedOperationException("The Swing renderer does not support 3D!");
}

@Override
Expand Down
54 changes: 52 additions & 2 deletions src/main/java/tanks/Drawing.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import tanks.obstacle.Obstacle;
import tanks.tank.TankPlayer;

import java.util.ArrayList;

public class Drawing
{
protected static boolean initialized = false;
Expand Down Expand Up @@ -51,6 +53,8 @@ public class Drawing
public double currentColorB;
public double currentColorA;

public static final double track_offset = 20;

public static Model rotatedRect = new Model();

private Drawing() {}
Expand Down Expand Up @@ -625,6 +629,18 @@ public void addVertex(double x, double y, double z)
Game.game.window.addVertex(drawX, drawY);
}

public void addInterfaceVertex(double x, double y, double z)
{
double drawX = (interfaceScale * x + Math.max(0, Panel.windowWidth - interfaceSizeX * interfaceScale) / 2);
double drawY = (interfaceScale * y + Math.max(0, Panel.windowHeight - statsHeight - interfaceSizeY * interfaceScale) / 2);
double drawZ = z * scale;

if (Game.enable3d)
Game.game.window.addVertex(drawX, drawY, drawZ);
else
Game.game.window.addVertex(drawX, drawY);
}

public void addFacingVertex(double x, double y, double z, double sX, double sY, double sZ)
{
if (Game.enable3d && Game.screen instanceof ScreenGame && ((ScreenGame) Game.screen).slant != 0)
Expand Down Expand Up @@ -884,7 +900,24 @@ public double getPlayerOffsetX()
if (!enableMovingCameraX)
return 0;

double result = (playerX - (Panel.windowWidth) / scale / 2);
while (Panel.panel.pastPlayerTime.size() > 1 && Panel.panel.pastPlayerTime.get(1) < Panel.panel.age - track_offset)
{
Panel.panel.pastPlayerX.remove(0);
Panel.panel.pastPlayerY.remove(0);
Panel.panel.pastPlayerTime.remove(0);
}

double x = playerX;

if (Panel.panel.pastPlayerTime.size() == 1)
x = Panel.panel.pastPlayerX.get(0);
else if (Panel.panel.pastPlayerTime.size() > 1)
{
double frac = (Panel.panel.age - track_offset - Panel.panel.pastPlayerTime.get(0)) * 1.0 / (Panel.panel.pastPlayerTime.get(1) - Panel.panel.pastPlayerTime.get(0));
x = Panel.panel.pastPlayerX.get(0) * (1 - frac) + Panel.panel.pastPlayerX.get(1) * frac;
}

double result = (x - (Panel.windowWidth) / scale / 2);

double margin = Math.max(0, Math.min(Game.tile_size * 2, Game.currentSizeX * Game.tile_size * Drawing.drawing.scale - Panel.windowWidth)) / 2;

Expand Down Expand Up @@ -916,7 +949,24 @@ public double getPlayerOffsetY()
if (!enableMovingCameraY)
return 0;

double result = (playerY - (Panel.windowHeight - statsHeight) / scale / 2);
while (Panel.panel.pastPlayerTime.size() > 1 && Panel.panel.pastPlayerTime.get(1) < Panel.panel.age - track_offset)
{
Panel.panel.pastPlayerX.remove(0);
Panel.panel.pastPlayerY.remove(0);
Panel.panel.pastPlayerTime.remove(0);
}

double y = playerY;

if (Panel.panel.pastPlayerTime.size() == 1)
y = Panel.panel.pastPlayerY.get(0);
else if (Panel.panel.pastPlayerTime.size() > 1)
{
double frac = (Panel.panel.age - track_offset - Panel.panel.pastPlayerTime.get(0)) * 1.0 / (Panel.panel.pastPlayerTime.get(1) - Panel.panel.pastPlayerTime.get(0));
y = Panel.panel.pastPlayerY.get(0) * (1 - frac) + Panel.panel.pastPlayerY.get(1) * frac;
}

double result = (y - (Panel.windowHeight - statsHeight) / scale / 2);

double margin = Math.max(0, Math.min(Game.tile_size * 2, Game.currentSizeY * Game.tile_size * Drawing.drawing.scale - (Panel.windowHeight - Drawing.drawing.statsHeight))) / 2;

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tanks/Effect.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public enum EffectType {fire, smokeTrail, trail, ray, mineExplosion, laser, piec
public double angle;
public double distance;

public int drawLayer = 7;

public static Effect createNewEffect(double x, double y, double z, EffectType type)
{
if (Game.recycleEffects.size() > 0)
Expand Down Expand Up @@ -156,6 +158,7 @@ protected void refurbish()
this.distance = 0;
this.radius = 0;
this.enableGlow = true;
this.drawLayer = 7;
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/tanks/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public enum Framework {lwjgl, swing, libgdx}
public static double[][] tilesDepth = new double[28][18];

//Remember to change the version in android's build.gradle and ios's robovm.properties
public static final String version = "Tanks v0.9.g";
public static final int network_protocol = 19;
public static final String version = "Tanks v0.9.0";
public static final int network_protocol = 20;
public static boolean debug = false;

public static int port = 8080;
Expand Down Expand Up @@ -230,6 +230,7 @@ public static void registerEvents()
NetworkEventMap.register(EventObstacleShrubberyBurn.class);
NetworkEventMap.register(EventPlaySound.class);
NetworkEventMap.register(EventSendTankColors.class);
NetworkEventMap.register(EventShareLevel.class);

NetworkEventMap.register(EventSendOnlineClientDetails.class);
NetworkEventMap.register(EventSilentDisconnect.class);
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/tanks/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ else if (ScreenPartyLobby.isClient)

this.remote = remote;

if (!remote)
if (!remote && sc == null || (sc instanceof ScreenLevelBuilder))
Game.eventsOut.add(new EventLoadLevel(this));

ArrayList<EventCreatePlayer> playerEvents = new ArrayList<EventCreatePlayer>();
Expand All @@ -125,6 +125,8 @@ else if (ScreenPartyLobby.isClient)
Game.currentLevel = this;
Game.currentLevelString = this.levelString;

ScreenGame.finishedQuick = false;

ScreenGame.finished = false;
ScreenGame.finishTimer = ScreenGame.finishTimerMax;

Expand Down Expand Up @@ -188,6 +190,7 @@ else if (t.length >= 2)

s.width = sX;
s.height = sY;
s.selectedTiles = new boolean[sX][sY];

s.r = r;
s.g = g;
Expand Down Expand Up @@ -428,7 +431,7 @@ public void run()
this.availablePlayerSpawns.clear();

int playerCount = 1;
if (ScreenPartyHost.isServer && ScreenPartyHost.server != null)
if (ScreenPartyHost.isServer && ScreenPartyHost.server != null && sc == null)
playerCount += ScreenPartyHost.server.connections.size();

if (this.includedPlayers.size() > 0)
Expand Down Expand Up @@ -598,7 +601,7 @@ else if (!remote)
for (EventCreatePlayer e: playerEvents)
e.execute();

if (!remote)
if (!remote && sc == null || (sc instanceof ScreenLevelBuilder))
Game.eventsOut.add(new EventEnterLevel());
}

Expand Down
Loading

0 comments on commit 4ce8a89

Please sign in to comment.