diff --git a/core/assets/music/1.mp3 b/core/assets/music/1.mp3 new file mode 100644 index 0000000000..711f236d49 Binary files /dev/null and b/core/assets/music/1.mp3 differ diff --git a/core/assets/music/2.mp3 b/core/assets/music/2.mp3 new file mode 100644 index 0000000000..d25ee1052f Binary files /dev/null and b/core/assets/music/2.mp3 differ diff --git a/core/assets/music/3.mp3 b/core/assets/music/3.mp3 new file mode 100644 index 0000000000..f67b58d985 Binary files /dev/null and b/core/assets/music/3.mp3 differ diff --git a/core/assets/sounds/break.wav b/core/assets/sounds/break.wav new file mode 100644 index 0000000000..12037628a4 Binary files /dev/null and b/core/assets/sounds/break.wav differ diff --git a/core/assets/sounds/corexplode.wav b/core/assets/sounds/corexplode.wav new file mode 100644 index 0000000000..f54b2b0c1b Binary files /dev/null and b/core/assets/sounds/corexplode.wav differ diff --git a/core/assets/sounds/enemyshoot.wav b/core/assets/sounds/enemyshoot.wav new file mode 100644 index 0000000000..875955c923 Binary files /dev/null and b/core/assets/sounds/enemyshoot.wav differ diff --git a/core/assets/sounds/explosion.wav b/core/assets/sounds/explosion.wav new file mode 100644 index 0000000000..b21bca5af9 Binary files /dev/null and b/core/assets/sounds/explosion.wav differ diff --git a/core/assets/sounds/flame.wav b/core/assets/sounds/flame.wav new file mode 100644 index 0000000000..3d92dc27b0 Binary files /dev/null and b/core/assets/sounds/flame.wav differ diff --git a/core/assets/sounds/place.wav b/core/assets/sounds/place.wav new file mode 100644 index 0000000000..f9f194d208 Binary files /dev/null and b/core/assets/sounds/place.wav differ diff --git a/core/assets/sounds/shoot.wav b/core/assets/sounds/shoot.wav new file mode 100644 index 0000000000..df95d03a3c Binary files /dev/null and b/core/assets/sounds/shoot.wav differ diff --git a/core/assets/sounds/spawn.wav b/core/assets/sounds/spawn.wav new file mode 100644 index 0000000000..140461a2ec Binary files /dev/null and b/core/assets/sounds/spawn.wav differ diff --git a/core/src/io/anuke/moment/Control.java b/core/src/io/anuke/moment/Control.java index 9048f3ed0b..2bfd74f965 100644 --- a/core/src/io/anuke/moment/Control.java +++ b/core/src/io/anuke/moment/Control.java @@ -13,7 +13,7 @@ import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import io.anuke.moment.ai.Pathfind; -import io.anuke.moment.entities.BossEnemy; +import io.anuke.moment.entities.Enemy; import io.anuke.moment.entities.TileEntity; import io.anuke.moment.resource.ItemStack; import io.anuke.moment.world.Tile; @@ -39,6 +39,10 @@ public class Control extends RendererModule{ cameraScale = 4f; setPixelation(); buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale)); + + USound.load("shoot.wav", "place.wav", "explosion.wav", "enemyshoot.wav", "corexplode.wav", "break.wav", "spawn.wav", "flame.wav"); + UMusic.load("1.mp3", "2.mp3", "3.mp3"); + UMusic.shuffleAll(); } @Override @@ -170,7 +174,7 @@ public class Control extends RendererModule{ //TODO if(UInput.keyUp(Keys.G)){ - new BossEnemy(0).set(main.player.x, main.player.y).add(); + new Enemy(0).set(main.player.x, main.player.y).add(); } //new FlameEnemy(0).set(main.player.x, main.player.y).add(); @@ -186,6 +190,7 @@ public class Control extends RendererModule{ Effects.effect("place", roundx(), roundy()); Effects.shake(2f, 2f); + USound.play("place"); for(ItemStack stack : main.recipe.requirements){ main.removeItem(stack); diff --git a/core/src/io/anuke/moment/Moment.java b/core/src/io/anuke/moment/Moment.java index 6c30817be9..fbd71f8abe 100644 --- a/core/src/io/anuke/moment/Moment.java +++ b/core/src/io/anuke/moment/Moment.java @@ -12,9 +12,7 @@ import io.anuke.moment.resource.Recipe; import io.anuke.moment.world.Generator; import io.anuke.moment.world.Tile; import io.anuke.moment.world.TileType; -import io.anuke.ucore.core.KeyBinds; -import io.anuke.ucore.core.Settings; -import io.anuke.ucore.core.UInput; +import io.anuke.ucore.core.*; import io.anuke.ucore.entities.Effects; import io.anuke.ucore.entities.Entities; import io.anuke.ucore.modules.ModuleController; @@ -42,6 +40,7 @@ public class Moment extends ModuleController{ public boolean playing = false; public boolean paused = false; + public boolean showedTutorial = false; @Override public void init(){ @@ -82,9 +81,9 @@ public class Moment extends ModuleController{ @Override public void update(){ if(!paused) - super.update(); + super.update(); - if(!playing) return; + if(!playing || paused) return; if(UInput.keyUp(Keys.Q)) System.out.println("Enemies: " + Enemy.amount + " Wavetime: " + wavetime + " Wave: " + wave + " Wavespace: " + wavespace); @@ -99,7 +98,16 @@ public class Moment extends ModuleController{ public void play(){ wavetime = waveSpacing(); - playing = true; + + if(showedTutorial){ + playing = true; + paused = false; + }else{ + playing = true; + paused = true; + get(UI.class).tutorial.show(get(UI.class).scene); + showedTutorial = true; + } } public void restart(){ @@ -127,6 +135,7 @@ public class Moment extends ModuleController{ public void coreDestroyed(){ Effects.shake(5, 6); + USound.play("corexplode"); for(int i = 0; i < 16; i ++){ Timers.run(i*2, ()->{ Effects.effect("explosion", core.worldx()+Mathf.range(40), core.worldy()+Mathf.range(40)); @@ -173,6 +182,7 @@ public class Moment extends ModuleController{ public void runWave(){ int amount = wave; + USound.play("spawn"); for(int i = 0; i < amount; i ++){ int pos = i; diff --git a/core/src/io/anuke/moment/UI.java b/core/src/io/anuke/moment/UI.java index 9aa9f3fefc..c2a53e618f 100644 --- a/core/src/io/anuke/moment/UI.java +++ b/core/src/io/anuke/moment/UI.java @@ -26,7 +26,7 @@ public class UI extends SceneModule{ Table itemtable; PrefsDialog prefs; KeybindDialog keys; - Dialog about, menu, restart; + Dialog about, menu, restart, tutorial; BooleanSupplier play = () -> { return main.playing; @@ -45,9 +45,16 @@ public class UI extends SceneModule{ } void drawBackground(){ - //float w = gwidth(); - //float h = gheight(); - Draw.rect("player", 0, 0, 100, 100); + + Draw.color(); + float w = gwidth(); + float h = gheight(); + Draw.tscl(1.5f); + Draw.text("[DARK_GRAY]-( Mindustry )-", w/2, h-16); + Draw.text("[#f1de60]-( Mindustry )-", w/2, h-10); + + Draw.tscl(0.5f); + //Draw.rect("conveyor", w/2, h/2, 1000, 1000); } @Override @@ -116,9 +123,39 @@ public class UI extends SceneModule{ keys = new KeybindDialog(); about = new Dialog("About"); - about.getContentTable().add("Made by Anuken for the" + "\nGDL Metal Monstrosity jam." + "\nTools used:"); + about.getContentTable().add("Made by [ROYAL]Anuken[] for the" + "\nGDL Metal Monstrosity jam.\n" + + "\nSources used:" + + "\n- [YELLOW]bfxr.com[] for sound effects" + + "\n- [RED]freemusicarchive.org[] for music" + + "\n- Music made by [GREEN]RoccoW[]" + ); about.addCloseButton(); + tutorial = new Dialog("Tutorial", "dialog"){ + @Override + public void hide(){ + super.hide(); + main.playing = true; + main.paused = false; + } + }; + tutorial.addCloseButton(); + tutorial.getButtonTable().addButton("OK", ()->{ + tutorial.hide(); + }); + + tutorial.content().add( + "[GREEN]Default Controls:[WHITE]\n[YELLOW][[WASD][] to move, [YELLOW][[R][] to rotate blocks." + + "\n[YELLOW][[R-MOUSE][] to destroy blocks, [YELLOW][[L-MOUSE][] to place them." + + "\n[YELLOW][[L-MOUSE][] to shoot." + + "\n\n[GOLD]Every 20 seconds, a new wave will appear." + + "\nBuild turrets to defend the core." + + "\nIf the core is destroyed, you lose the game." + + "\n[LIME]To collect building resources, \nmove them into the core with conveyors." + ); + + tutorial.content().pad(8); + restart = new Dialog("The core was destroyed.", "dialog"){ public Dialog show(Scene scene){ super.show(scene); @@ -269,6 +306,7 @@ public class UI extends SceneModule{ table.add().size(size); } + //TODO rows //if((int)((float)recipes.size/rows+1) == 2){ // table.row(); //} @@ -283,64 +321,6 @@ public class UI extends SceneModule{ row(); add(stack).colspan(3); - - /* - for(Recipe r : Recipe.values()){ - Image image = new Image(Draw.region(r.result.name())); - - get().add(image).size(40); - - if(i % rows == rows-1) - row(); - - i++; - /* - new button(r.result.name(), () -> { - main.recipe = r; - }){{ - get().clearChildren(); - get().pad(10f); - get().add(image).size(42).padRight(4f); - Table table = new Table(); - table.add(get().getLabel()).left(); - get().add(table); - get().left(); - - ItemStack[] req = r.requirements; - for(ItemStack stack : req){ - table.row(); - table.add("[YELLOW]" + stack.amount + "x " + stack.item.name()).left(); - } - get().getLabel().setAlignment(Align.left); - - String description = r.result.description(); - if(r.result.ammo != null){ - description += "\n[SALMON]Ammo: " + r.result.ammo.name(); - } - - Table tiptable = new Table(); - tiptable.background("button"); - tiptable.add("[PURPLE]" + r.result.name(), 0.5f).left().padBottom(2f); - tiptable.row(); - tiptable.add("[ORANGE]" + description).left(); - tiptable.pad(10f); - - Tooltip tip = new Tooltip(tiptable); - tip.setInstant(true); - - get().addListener(tip); - - Recipe current = r; - get().update(() -> { - get().setDisabled(!main.hasItems(current.requirements)); - }); - - }}.width(234f); - - //row(); - } - */ - get().pad(10f); }}.right().bottom(); @@ -394,7 +374,30 @@ public class UI extends SceneModule{ get().setVisible(play); }}.end(); - + + + //+- table + new table(){{ + aleft(); + abottom(); + Control c = main.get(Control.class); + new button("+", ()->{ + if(c.cameraScale < 4f){ + c.cameraScale = 4f; + c.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + } + }).size(40); + + new button("-", ()->{ + if(c.cameraScale > 3f){ + c.cameraScale = 3f; + c.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + } + }).size(40); + + get().setVisible(play); + }}.end(); + //menu table new table(){{ float w = 200; diff --git a/core/src/io/anuke/moment/entities/Enemy.java b/core/src/io/anuke/moment/entities/Enemy.java index a1a392e602..6f342ef919 100644 --- a/core/src/io/anuke/moment/entities/Enemy.java +++ b/core/src/io/anuke/moment/entities/Enemy.java @@ -7,6 +7,7 @@ import io.anuke.moment.Moment; import io.anuke.moment.ai.Pathfind; import io.anuke.moment.world.TileType; import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.USound; import io.anuke.ucore.entities.*; import io.anuke.ucore.util.Timers; @@ -24,6 +25,7 @@ public class Enemy extends DestructibleEntity{ public BulletType bullet = BulletType.small; public float length = 4; public float rotatespeed = 8f; + public String shootsound = "enemyshoot"; public Enemy(int spawn){ this.spawn = spawn; @@ -46,13 +48,16 @@ public class Enemy extends DestructibleEntity{ target = TileType.findTileTarget(x, y, null, range, false); if(target != null){ - if(Timers.get(this, reload)) + if(Timers.get(this, reload)){ shoot(); + USound.play(shootsound); + } } } public void shoot(){ + vector.set(length, 0).rotate(direction.angle()); new Bullet(bullet, this, x+vector.x, y+vector.y, direction.angle()).add(); } @@ -66,6 +71,7 @@ public class Enemy extends DestructibleEntity{ public void onDeath(){ Effects.effect("explosion", this); Effects.shake(3f, 4f); + USound.play("explosion"); remove(); } diff --git a/core/src/io/anuke/moment/entities/FlameEnemy.java b/core/src/io/anuke/moment/entities/FlameEnemy.java index 0bd3df30f7..0d473a9d8a 100644 --- a/core/src/io/anuke/moment/entities/FlameEnemy.java +++ b/core/src/io/anuke/moment/entities/FlameEnemy.java @@ -6,11 +6,13 @@ public class FlameEnemy extends Enemy{ public FlameEnemy(int spawn) { super(spawn); - speed = 0.3f; + + speed = 0.35f; maxhealth = 150; reload = 6; bullet = BulletType.flameshot; + shootsound = "flame"; range = 40; diff --git a/core/src/io/anuke/moment/entities/Player.java b/core/src/io/anuke/moment/entities/Player.java index 1917d30741..77b3589e76 100644 --- a/core/src/io/anuke/moment/entities/Player.java +++ b/core/src/io/anuke/moment/entities/Player.java @@ -8,6 +8,7 @@ import io.anuke.moment.Moment; import io.anuke.moment.UI; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.UInput; +import io.anuke.ucore.core.USound; import io.anuke.ucore.entities.DestructibleEntity; import io.anuke.ucore.entities.Effects; import io.anuke.ucore.util.Angles; @@ -72,6 +73,7 @@ public class Player extends DestructibleEntity{ if(shooting && reload <= 0){ weapon.shoot(this); + USound.play("shoot"); reload = weapon.reload; } diff --git a/core/src/io/anuke/moment/entities/TileEntity.java b/core/src/io/anuke/moment/entities/TileEntity.java index 918ef72797..0f1aa69cb4 100644 --- a/core/src/io/anuke/moment/entities/TileEntity.java +++ b/core/src/io/anuke/moment/entities/TileEntity.java @@ -8,6 +8,7 @@ import io.anuke.moment.ai.Pathfind; import io.anuke.moment.resource.Item; import io.anuke.moment.world.Tile; import io.anuke.moment.world.TileType; +import io.anuke.ucore.core.USound; import io.anuke.ucore.entities.Effects; import io.anuke.ucore.entities.Entity; @@ -40,6 +41,8 @@ public class TileEntity extends Entity{ Pathfind.updatePath(); Effects.shake(4f, 4f); Effects.effect("explosion", this); + + USound.play("break"); } public void collision(Bullet other){ diff --git a/core/src/io/anuke/moment/resource/Recipe.java b/core/src/io/anuke/moment/resource/Recipe.java index 694ab3b79b..5d36747ee3 100644 --- a/core/src/io/anuke/moment/resource/Recipe.java +++ b/core/src/io/anuke/moment/resource/Recipe.java @@ -7,28 +7,28 @@ import com.badlogic.gdx.utils.Array; import io.anuke.moment.world.TileType; public enum Recipe{ - stonewall(distribution, TileType.stonewall, stack(Item.stone, 4)), - ironwall(distribution, TileType.ironwall, stack(Item.iron, 4)), - steelwall(distribution, TileType.steelwall, stack(Item.steel, 4)), + stonewall(distribution, TileType.stonewall, stack(Item.stone, 5)), + ironwall(distribution, TileType.ironwall, stack(Item.iron, 5)), + steelwall(distribution, TileType.steelwall, stack(Item.steel, 5)), conveyor(distribution, TileType.conveyor, stack(Item.stone, 1)), fastconveyor(distribution, TileType.steelconveyor, stack(Item.steel, 1)), router(distribution, TileType.router, stack(Item.stone, 3)), - turret(defense, TileType.turret, stack(Item.stone, 4)), - dturret(defense, TileType.doubleturret, stack(Item.stone, 6)), - machineturret(defense, TileType.machineturret, stack(Item.iron, 10), stack(Item.stone, 6)), - shotgunturret(defense, TileType.shotgunturret, stack(Item.iron, 10), stack(Item.steel, 8)), - flameturret(defense, TileType.flameturret, stack(Item.iron, 12), stack(Item.steel, 12)), - sniperturret(defense, TileType.sniperturret, stack(Item.iron, 15), stack(Item.steel, 20)), + turret(defense, TileType.turret, stack(Item.stone, 8)), + dturret(defense, TileType.doubleturret, stack(Item.stone, 12)), + machineturret(defense, TileType.machineturret, stack(Item.iron, 15), stack(Item.stone, 20)), + shotgunturret(defense, TileType.shotgunturret, stack(Item.iron, 15), stack(Item.steel, 24)), + flameturret(defense, TileType.flameturret, stack(Item.iron, 25), stack(Item.steel, 18)), + sniperturret(defense, TileType.sniperturret, stack(Item.iron, 30), stack(Item.steel, 20)), healturret(defense, TileType.healturret, stack(Item.iron, 40)), megahealturret(defense, TileType.megahealturret, stack(Item.iron, 30), stack(Item.steel, 40)), - drill(production, TileType.stonedrill, stack(Item.stone, 5)), - irondrill(production, TileType.irondrill, stack(Item.stone, 30)), - coaldrill(production, TileType.coaldrill, stack(Item.stone, 30), stack(Item.iron, 30)), - smelter(production, TileType.smelter, stack(Item.stone, 40), stack(Item.iron, 40)); + drill(production, TileType.stonedrill, stack(Item.stone, 6)), + irondrill(production, TileType.irondrill, stack(Item.stone, 40)), + coaldrill(production, TileType.coaldrill, stack(Item.stone, 40), stack(Item.iron, 40)), + smelter(production, TileType.smelter, stack(Item.stone, 80), stack(Item.iron, 80)); public TileType result; public ItemStack[] requirements; diff --git a/core/src/io/anuke/moment/world/TileType.java b/core/src/io/anuke/moment/world/TileType.java index 85e750add3..6ea158ae88 100644 --- a/core/src/io/anuke/moment/world/TileType.java +++ b/core/src/io/anuke/moment/world/TileType.java @@ -10,6 +10,7 @@ import io.anuke.moment.entities.*; import io.anuke.moment.entities.TileEntity.ItemPos; import io.anuke.moment.resource.Item; import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.USound; import io.anuke.ucore.entities.*; import io.anuke.ucore.graphics.Hue; import io.anuke.ucore.util.Angles; @@ -330,11 +331,11 @@ public enum TileType{ }, flameturret(true, true, false){ { - range = 30f; - reload = 6f; + range = 35f; + reload = 5f; bullet = BulletType.flame; ammo = Item.coal; - health = 75; + health = 85; } public void update(Tile tile){ @@ -380,7 +381,7 @@ public enum TileType{ }, shotgunturret(true, true, false){ { - range = 65; + range = 50; reload = 40f; bullet = BulletType.iron; ammo = Item.iron; @@ -405,10 +406,11 @@ public enum TileType{ @Override void shoot(Tile tile){ - vector.set(0, 4).setAngle(tile.entity.rotation); + for(int i = 0; i < 6; i ++) - Timers.run(i, ()->{ - bullet(tile, tile.entity.rotation + Mathf.range(6)); + Timers.run(i/1.5f, ()->{ + vector.set(4, 0).setAngle(tile.entity.rotation); + bullet(tile, tile.entity.rotation + Mathf.range(16)); }); } @@ -470,8 +472,8 @@ public enum TileType{ megahealturret(true, true, false){ { range = 30; - reload = 25f; - health = 60; + reload = 20f; + health = 80; } public void update(Tile tile){ @@ -562,6 +564,7 @@ public enum TileType{ if(enemy != null){ tile.entity.rotation = MathUtils.lerpAngleDeg(tile.entity.rotation, Angles.predictAngle(tile.worldx(), tile.worldy(), enemy.x, enemy.y, enemy.xvelocity, enemy.yvelocity, bullet.speed - 0.1f), 0.2f); if(Timers.get(tile, reload)){ + USound.play("shoot"); shoot(tile); tile.entity.shots--; }