Skip to content

Commit

Permalink
Tanks v1.5.0 - arcade mode and more
Browse files Browse the repository at this point in the history
  • Loading branch information
aehmttw committed Mar 23, 2023
1 parent 77f86bb commit b71bffa
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 122 deletions.
1 change: 1 addition & 0 deletions src/main/java/lwjglwindow/LWJGLWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ protected boolean tick(boolean resizing)

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


glfwGetWindowSize(window, w, h);

if (w[0] > 0 || h[0] > 0)
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/lwjglwindow/SoundPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public class SoundPlayer extends BaseSoundPlayer
public float prevVolume;
public float currentVolume;

public static final int total_sounds = 255;
public static final int max_music = 50;

protected void playMusicSource(int i)
{
alSourcePlay(i);
Expand All @@ -69,7 +72,7 @@ protected void stopMusicSource(int i)

protected int newMusicSource()
{
if (musicSources.size() >= 25)
if (musicSources.size() >= max_music)
{
for (int i = 0; i < musicSources.size(); i++)
{
Expand Down Expand Up @@ -147,7 +150,7 @@ public void playSound(String path, float pitch)

public void playSound(String path, float pitch, float volume)
{
if (sources.size() >= 230)
if (sources.size() >= total_sounds - max_music)
alDeleteSources(sources.remove(0));

if (this.buffers.get(path) == null)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/tanks/Effect.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ else if (type == EffectType.shield)
this.maxAge = 50;
else if (type == EffectType.chain || type == EffectType.tutorialProgress)
{
this.drawLayer = 9;
this.maxAge = 100;
this.size = Game.tile_size * 2;
}
Expand Down
252 changes: 133 additions & 119 deletions src/main/java/tanks/gui/screen/ScreenCinematicTitle.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,130 +41,144 @@ public ScreenCinematicTitle()
@Override
public void drawWithoutBackground()
{
/*Drawing.drawing.setInterfaceFontSize(70);
Drawing.drawing.setColor(0, 0, 0);
Drawing.drawing.drawInterfaceText(this.centerX, this.centerY - 70, "Go wild with a hundred options");
Drawing.drawing.drawInterfaceText(this.centerX, this.centerY + 70,"to customize for each tank!");*/
//Drawing.drawing.drawInterfaceText(this.centerX, this.centerY,"Make your own custom tanks!");

Drawing.drawing.setColor(174, 92, 16);
Drawing.drawing.fillInterfaceRect(Drawing.drawing.interfaceSizeX / 2, Drawing.drawing.interfaceSizeY / 2, Game.game.window.absoluteWidth / Drawing.drawing.interfaceScale, Game.game.window.absoluteHeight / Drawing.drawing.interfaceScale);

Drawing.drawing.setColor(255, 255, 255);
Drawing.drawing.drawInterfaceImage("img.png", this.centerX, this.centerY, Drawing.drawing.interfaceSizeX, Drawing.drawing.interfaceSizeY);

Drawing.drawing.setColor(255, 255, 255, 127);
Drawing.drawing.fillInterfaceRect(Math.min(t * 20 / 2, Drawing.drawing.interfaceSizeX / 2), this.centerY, Math.min(t * 20, Drawing.drawing.interfaceSizeX), 280);


if (mine.destroy)
{
t2 = Math.min(t2 + Panel.frameFrequency * 2, 50);

Drawing.drawing.setColor(Turret.calculateSecondaryColor(0), Turret.calculateSecondaryColor(150), Turret.calculateSecondaryColor(255));
Drawing.drawing.setInterfaceFontSize(160 * t2 / 50);
Drawing.drawing.drawInterfaceText(mine.posX + 8, mine.posY - t2 * 0.5 + 8, "Tanks");
Drawing.drawing.setInterfaceFontSize(64 * t2 / 50);
Drawing.drawing.setColor(0, 0, 0);
Drawing.drawing.drawInterfaceText(mine.posX + 4, mine.posY + t2 * 1.5 + 4, "The Crusades");

Drawing.drawing.setColor(0, 150, 255);
Drawing.drawing.setInterfaceFontSize(160 * t2 / 50);
Drawing.drawing.drawInterfaceText(mine.posX, mine.posY - t2 * 0.5, "Tanks");
Drawing.drawing.setColor(Turret.calculateSecondaryColor(0), Turret.calculateSecondaryColor(150), Turret.calculateSecondaryColor(255));
Drawing.drawing.setInterfaceFontSize(64 * t2 / 50);
Drawing.drawing.drawInterfaceText(mine.posX, mine.posY + t2 * 1.5, "The Crusades");
}

if (t >= 600)
{
double a = Math.min(t - 600, 50) * 2.55 * 2;
Drawing.drawing.setColor(180, 180, 180, a);
Drawing.drawing.fillInterfaceGlow(this.centerX, this.centerY + 170, 600, 140);
Drawing.drawing.fillInterfaceGlow(this.centerX, this.centerY + 340, 1200, 140);
Drawing.drawing.setColor(0, 0, 0, a);
Drawing.drawing.drawInterfaceText(this.centerX, this.centerY + 170, "Update 1.4");
Drawing.drawing.setInterfaceFontSize(64 * t2 / 75);
Drawing.drawing.drawInterfaceText(this.centerX, this.centerY + 340, "Make your own custom tanks!");

}

for (int i = 0; i < Game.tracks.size(); i++)
{
Game.tracks.get(i).draw();
}

for (int i = Game.movables.size() - 1; i >= 0; i--)
{
Game.movables.get(i).draw();
}

for (int i = 0; i < Game.effects.size(); i++)
{
Game.effects.get(i).draw();
}

for (int i = 0; i < Game.effects.size(); i++)
{
Game.effects.get(i).drawGlow();
}
Drawing.drawing.setInterfaceFontSize(70);

double c = 0.5 - (8) * 3.0 / 30;
if (c < 0)
c = 1 + c;

double[] col = Game.getRainbowColor(c);

Drawing.drawing.setColor(col[0] / 2, col[1] / 2, col[2] / 2);
Drawing.drawing.drawInterfaceText(this.centerX + 5, this.centerY - 50 + 5, "Get bonuses");
Drawing.drawing.drawInterfaceText(this.centerX + 5, this.centerY + 50 + 5,"based on your performance!");
Drawing.drawing.setColor(col[0], col[1], col[2]);
Drawing.drawing.drawInterfaceText(this.centerX, this.centerY - 50, "Get bonuses");
Drawing.drawing.drawInterfaceText(this.centerX, this.centerY + 50,"based on your performance!");

// Drawing.drawing.setColor(col[0] / 2, col[1] / 2, col[2] / 2);
// Drawing.drawing.drawInterfaceText(this.centerX + 5, this.centerY + 5, "...and even crazier!");
// Drawing.drawing.setColor(col[0], col[1], col[2]);
// Drawing.drawing.drawInterfaceText(this.centerX, this.centerY, "...and even crazier!");

// Drawing.drawing.setColor(174, 92, 16);
// Drawing.drawing.fillInterfaceRect(Drawing.drawing.interfaceSizeX / 2, Drawing.drawing.interfaceSizeY / 2, Game.game.window.absoluteWidth / Drawing.drawing.interfaceScale, Game.game.window.absoluteHeight / Drawing.drawing.interfaceScale);
//
// Drawing.drawing.setColor(255, 255, 255);
// Drawing.drawing.drawInterfaceImage("img.png", this.centerX, this.centerY, Drawing.drawing.interfaceSizeX, Drawing.drawing.interfaceSizeY);
//
// Drawing.drawing.setColor(255, 255, 255, 127);
// Drawing.drawing.fillInterfaceRect(Math.min(t * 20 / 2, Drawing.drawing.interfaceSizeX / 2), this.centerY, Math.min(t * 20, Drawing.drawing.interfaceSizeX), 280);
//
//
// if (mine.destroy)
// {
// t2 = Math.min(t2 + Panel.frameFrequency * 2, 50);
//
// Drawing.drawing.setColor(Turret.calculateSecondaryColor(0), Turret.calculateSecondaryColor(150), Turret.calculateSecondaryColor(255));
// Drawing.drawing.setInterfaceFontSize(160 * t2 / 50);
// Drawing.drawing.drawInterfaceText(mine.posX + 8, mine.posY - t2 * 0.5 + 8, "Tanks");
// Drawing.drawing.setInterfaceFontSize(64 * t2 / 50);
// Drawing.drawing.setColor(0, 0, 0);
// Drawing.drawing.drawInterfaceText(mine.posX + 4, mine.posY + t2 * 1.5 + 4, "The Crusades");
//
// Drawing.drawing.setColor(0, 150, 255);
// Drawing.drawing.setInterfaceFontSize(160 * t2 / 50);
// Drawing.drawing.drawInterfaceText(mine.posX, mine.posY - t2 * 0.5, "Tanks");
// Drawing.drawing.setColor(Turret.calculateSecondaryColor(0), Turret.calculateSecondaryColor(150), Turret.calculateSecondaryColor(255));
// Drawing.drawing.setInterfaceFontSize(64 * t2 / 50);
// Drawing.drawing.drawInterfaceText(mine.posX, mine.posY + t2 * 1.5, "The Crusades");
// }
//
// if (t >= 600)
// {
// double a = Math.min(t - 600, 50) * 2.55 * 2;
// Drawing.drawing.setColor(180, 180, 180, a);
// Drawing.drawing.fillInterfaceGlow(this.centerX, this.centerY + 170, 600, 140);
// Drawing.drawing.fillInterfaceGlow(this.centerX, this.centerY + 340, 1200, 140);
// Drawing.drawing.setColor(0, 0, 0, a);
// Drawing.drawing.drawInterfaceText(this.centerX, this.centerY + 170, "Update 1.5");
// Drawing.drawing.setInterfaceFontSize(64 * t2 / 75);
// Drawing.drawing.drawInterfaceText(this.centerX, this.centerY + 340, "Now with the crazy Arcade Mode!");
//
// }
//
// for (int i = 0; i < Game.tracks.size(); i++)
// {
// Game.tracks.get(i).draw();
// }
//
// for (int i = Game.movables.size() - 1; i >= 0; i--)
// {
// Game.movables.get(i).draw();
// }
//
// for (int i = 0; i < Game.effects.size(); i++)
// {
// Game.effects.get(i).draw();
// }
//
// for (int i = 0; i < Game.effects.size(); i++)
// {
// Game.effects.get(i).drawGlow();
// }
}

@Override
public void update()
{
if (t > 75 && !Game.movables.contains(mine) && !mine.destroy)
Game.movables.add(mine);

if (t > 0 && t < 100)
this.logo.vX = 2.5;
else if (t >= 100)
{
if (!shot)
{
Drawing.drawing.playGlobalSound("shoot.ogg");

Bullet b = new Bullet(this.logo.posX, this.logo.posY, 0, this.logo, this.logo.bullet);
b.size *= 2;
b.setPolarMotion(this.logo.angle, 3.125);
this.logo.addPolarMotion(b.getPolarDirection() + Math.PI, 25.0 / 32.0);

b.moveOut(50 / 3.125 * this.logo.size / Game.tile_size);
b.effect = Bullet.BulletEffect.trail;

Game.movables.add(b);
shot = true;
}

this.logo.vX *= 0.95;
}

Obstacle.draw_size = Game.tile_size;
for (int i = 0; i < Game.tracks.size(); i++)
{
Game.tracks.get(i).update();
}

for (int i = 0; i < Game.movables.size(); i++)
{
Movable m = Game.movables.get(i);
m.preUpdate();
m.update();
}

for (int i = 0; i < Game.effects.size(); i++)
{
Game.effects.get(i).update();
}

Game.tracks.removeAll(Game.removeTracks);
Game.removeTracks.clear();

Game.movables.removeAll(Game.removeMovables);
Game.removeMovables.clear();

Game.effects.removeAll(Game.removeEffects);
Game.removeEffects.clear();
// if (t > 75 && !Game.movables.contains(mine) && !mine.destroy)
// Game.movables.add(mine);
//
// if (t > 0 && t < 100)
// this.logo.vX = 2.5;
// else if (t >= 100)
// {
// if (!shot)
// {
// Drawing.drawing.playGlobalSound("shoot.ogg");
//
// Bullet b = new Bullet(this.logo.posX, this.logo.posY, 0, this.logo, this.logo.bullet);
// b.size *= 2;
// b.setPolarMotion(this.logo.angle, 3.125);
// this.logo.addPolarMotion(b.getPolarDirection() + Math.PI, 25.0 / 32.0);
//
// b.moveOut(50 / 3.125 * this.logo.size / Game.tile_size);
// b.effect = Bullet.BulletEffect.trail;
//
// Game.movables.add(b);
// shot = true;
// }
//
// this.logo.vX *= 0.95;
// }
//
// Obstacle.draw_size = Game.tile_size;
// for (int i = 0; i < Game.tracks.size(); i++)
// {
// Game.tracks.get(i).update();
// }
//
// for (int i = 0; i < Game.movables.size(); i++)
// {
// Movable m = Game.movables.get(i);
// m.preUpdate();
// m.update();
// }
//
// for (int i = 0; i < Game.effects.size(); i++)
// {
// Game.effects.get(i).update();
// }
//
// Game.tracks.removeAll(Game.removeTracks);
// Game.removeTracks.clear();
//
// Game.movables.removeAll(Game.removeMovables);
// Game.removeMovables.clear();
//
// Game.effects.removeAll(Game.removeEffects);
// Game.removeEffects.clear();
}

@Override
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/tanks/gui/screen/Tutorial.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,15 @@ else if (step == 4)
Drawing.drawing.addSyncedMusic("arcade/rampage3.ogg", Game.musicVolume, true, 500);
}
else if (step == 6)
{
Drawing.drawing.addSyncedMusic("arcade/rampage4.ogg", Game.musicVolume, true, 500);
Drawing.drawing.addSyncedMusic("arcade/rampage5.ogg", Game.musicVolume, true, 500);
}
else if (step == 8)
{
Game.movables.add(new Crate(this.gray));
Drawing.drawing.addSyncedMusic("arcade/rampage5.ogg", Game.musicVolume, true, 500);
Drawing.drawing.addSyncedMusic("arcade/rampage6.ogg", Game.musicVolume, true, 500);
Drawing.drawing.addSyncedMusic("arcade/rampage7.ogg", Game.musicVolume, true, 500);
}

stepAnimation = 0;
Expand Down

0 comments on commit b71bffa

Please sign in to comment.