diff --git a/core/assets/sounds/bloop.wav b/core/assets/sounds/bloop.wav new file mode 100644 index 0000000000..09a3463c89 Binary files /dev/null and b/core/assets/sounds/bloop.wav differ diff --git a/core/assets/sounds/die.wav b/core/assets/sounds/die.wav new file mode 100644 index 0000000000..b41b8ae317 Binary files /dev/null and b/core/assets/sounds/die.wav differ diff --git a/core/assets/sounds/flame2.wav b/core/assets/sounds/flame2.wav new file mode 100644 index 0000000000..54fc72a157 Binary files /dev/null and b/core/assets/sounds/flame2.wav differ diff --git a/core/assets/sounds/missile.wav b/core/assets/sounds/missile.wav new file mode 100644 index 0000000000..696dc26e57 Binary files /dev/null and b/core/assets/sounds/missile.wav differ diff --git a/core/assets/sounds/purchase.wav b/core/assets/sounds/purchase.wav new file mode 100644 index 0000000000..1ab87f4612 Binary files /dev/null and b/core/assets/sounds/purchase.wav differ diff --git a/core/assets/sounds/resonate.wav b/core/assets/sounds/resonate.wav new file mode 100644 index 0000000000..35609fe11c Binary files /dev/null and b/core/assets/sounds/resonate.wav differ diff --git a/core/assets/sounds/respawn.wav b/core/assets/sounds/respawn.wav new file mode 100644 index 0000000000..aeb8b0d2d1 Binary files /dev/null and b/core/assets/sounds/respawn.wav differ diff --git a/core/assets/sprites/mindustry.atlas b/core/assets/sprites/mindustry.atlas index 7d9c3f89c7..2612cc4c24 100644 --- a/core/assets/sprites/mindustry.atlas +++ b/core/assets/sprites/mindustry.atlas @@ -403,10 +403,24 @@ weapon-blaster orig: 8, 8 offset: 0, 0 index: -1 -weapon-trishot +weapon-flamethrower rotate: false xy: 178, 3 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 +weapon-multigun + rotate: false + xy: 188, 3 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +weapon-trishot + rotate: false + xy: 198, 3 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 diff --git a/core/assets/sprites/mindustry.png b/core/assets/sprites/mindustry.png index 37617bc2d9..4a8fe94621 100644 Binary files a/core/assets/sprites/mindustry.png and b/core/assets/sprites/mindustry.png differ diff --git a/core/src/io/anuke/mindustry/Control.java b/core/src/io/anuke/mindustry/Control.java index 8602fe30f7..a26d145b14 100644 --- a/core/src/io/anuke/mindustry/Control.java +++ b/core/src/io/anuke/mindustry/Control.java @@ -25,7 +25,9 @@ public class Control extends RendererModule{ atlas = new Atlas("mindustry.atlas"); - Sounds.load("shoot.wav", "place.wav", "explosion.wav", "enemyshoot.wav", "corexplode.wav", "break.wav", "spawn.wav", "flame.wav"); + Sounds.load("shoot.wav", "place.wav", "explosion.wav", "enemyshoot.wav", + "corexplode.wav", "break.wav", "spawn.wav", "flame.wav", "die.wav", + "respawn.wav", "purchase.wav", "flame2.wav"); Musics.load("1.mp3", "2.mp3", "3.mp3"); Generator.loadMaps(); @@ -83,6 +85,18 @@ public class Control extends RendererModule{ if(!paused){ + if(respawntime > 0){ + + respawntime -= delta(); + + if(respawntime <= 0){ + player.set(core.worldx(), core.worldy()-8); + player.heal(); + player.add(); + Effects.sound("respawn"); + } + } + if(enemies <= 0) wavetime -= delta(); diff --git a/core/src/io/anuke/mindustry/EffectLoader.java b/core/src/io/anuke/mindustry/EffectLoader.java index 35a7acdb17..e95209acac 100644 --- a/core/src/io/anuke/mindustry/EffectLoader.java +++ b/core/src/io/anuke/mindustry/EffectLoader.java @@ -45,6 +45,27 @@ public class EffectLoader{ Draw.spikes(e.x, e.y, e.ifract() * 3f, 2, 8); Draw.clear(); }); + + Effect.create("shoot", 8, e -> { + Draw.thickness(1f); + Draw.color(Hue.mix(Color.WHITE, Color.GOLD, e.ifract())); + Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 5); + Draw.clear(); + }); + + Effect.create("shoot2", 8, e -> { + Draw.thickness(1f); + Draw.color(Hue.mix(Color.WHITE, Color.SKY, e.ifract())); + Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5); + Draw.clear(); + }); + + Effect.create("shoot3", 8, e -> { + Draw.thickness(1f); + Draw.color(Hue.mix(Color.WHITE, Color.GOLD, e.ifract())); + Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5); + Draw.clear(); + }); Effect.create("explosion", 15, e -> { Draw.thickness(2f); @@ -76,7 +97,7 @@ public class EffectLoader{ Draw.clear(); }); - Effect.create("respawn", respawntime, e -> { + Effect.create("respawn", respawnduration, e -> { Draw.tcolor(Color.SCARLET); Draw.tscl(0.25f); Draw.text("Respawning in " + (int)((e.lifetime-e.time)/60), e.x, e.y); diff --git a/core/src/io/anuke/mindustry/Inventory.java b/core/src/io/anuke/mindustry/Inventory.java index e3ba894e3d..a5f2a40a90 100644 --- a/core/src/io/anuke/mindustry/Inventory.java +++ b/core/src/io/anuke/mindustry/Inventory.java @@ -16,6 +16,7 @@ public class Inventory{ items.put(Item.stone, 2000); items.put(Item.iron, 2000); items.put(Item.steel, 2000); + items.put(Item.coal, 2000); } } diff --git a/core/src/io/anuke/mindustry/UI.java b/core/src/io/anuke/mindustry/UI.java index 7c1f2f5561..6f8ffbf509 100644 --- a/core/src/io/anuke/mindustry/UI.java +++ b/core/src/io/anuke/mindustry/UI.java @@ -370,7 +370,26 @@ public class UI extends SceneModule{ }).width(w); get().setVisible(nplay); - }}; + }}.end(); + + new table(){{ + //atop(); + new table(){{ + get().background("button"); + + new label("Respawning in"){{ + get().update(()->{ + get().setText("[crimson]Respawning in " + (int)(respawntime/60)); + }); + + get().setFontScale(0.75f); + }}; + + visible(()->{ + return respawntime > 0; + }); + }}; + }}.end(); updateItems(); diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index 08ab27053d..5ad6df2757 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -15,7 +15,7 @@ import io.anuke.mindustry.world.Tile; /**ick, global state*/ public class Vars{ public static final float placerange = 66; - public static final float respawntime = 60*4; + public static final float respawnduration = 60*4; public static final float wavespace = 20*60; public static final float enemyspawnspace = 65; public static final float breakduration = 30; @@ -49,6 +49,8 @@ public class Vars{ public static int wave = 1; public static float wavetime; public static int enemies = 0; + + public static float respawntime; public static Tile core; public static Array spawnpoints = new Array(); diff --git a/core/src/io/anuke/mindustry/entities/BulletType.java b/core/src/io/anuke/mindustry/entities/BulletType.java index 6cc6368a1a..7a658fbc6f 100644 --- a/core/src/io/anuke/mindustry/entities/BulletType.java +++ b/core/src/io/anuke/mindustry/entities/BulletType.java @@ -68,6 +68,14 @@ public abstract class BulletType extends BaseBulletType{ Draw.rect("bullet", b.x, b.y, b.angle()); Draw.clear(); } + }, + shot2 = new BulletType(2.5f, 2){ + {lifetime=40;} + public void draw(Bullet b){ + Draw.color(Color.SKY); + Draw.rect("bullet", b.x, b.y, b.angle()); + Draw.clear(); + } }; private BulletType(float speed, int damage){ diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 495486585c..02a54fb0c8 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -29,13 +29,9 @@ public class Player extends DestructibleEntity{ remove(); Effects.effect("explosion", this); Effects.shake(4f, 5f); - Effects.effect("respawn", this); + Effects.sound("die", this); - Timers.run(respawntime, ()->{ - set(core.worldx(), core.worldy()-8); - heal(); - add(); - }); + respawntime = respawnduration; } @Override @@ -74,7 +70,7 @@ public class Player extends DestructibleEntity{ if(shooting && reload <= 0){ currentWeapon.shoot(this); - Sounds.play("shoot"); + Sounds.play(currentWeapon.shootsound); reload = currentWeapon.reload; } diff --git a/core/src/io/anuke/mindustry/entities/Weapon.java b/core/src/io/anuke/mindustry/entities/Weapon.java index 76a12f2f49..7c8ec8963f 100644 --- a/core/src/io/anuke/mindustry/entities/Weapon.java +++ b/core/src/io/anuke/mindustry/entities/Weapon.java @@ -1,17 +1,29 @@ package io.anuke.mindustry.entities; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.math.Vector2; + import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.ItemStack; +import io.anuke.ucore.core.Effects; import io.anuke.ucore.entities.Entity; import io.anuke.ucore.util.Angles; +import io.anuke.ucore.util.Mathf; public enum Weapon{ blaster(15, BulletType.shot, "Shoots a slow, weak bullet."){ { unlocked = true; } + + @Override + public void shoot(Player p){ + super.shoot(p); + Effects.effect("shoot3", p.x + vector.x, p.y+vector.y); + } }, - trishot(15, BulletType.shot, "Shoots 3 bullets in a spread.", stack(Item.iron, 40)){ + trishot(13, BulletType.shot, "Shoots 3 bullets in a spread.", stack(Item.iron, 40)){ @Override public void shoot(Player p){ @@ -21,14 +33,46 @@ public enum Weapon{ bullet(p, p.x, p.y, ang); bullet(p, p.x, p.y, ang+space); bullet(p, p.x, p.y, ang-space); + + Effects.effect("shoot", p.x + vector.x, p.y+vector.y); + + } + }, + multigun(6, BulletType.shot2, "Shoots inaccurate bullets with a high\nrate of fire.", stack(Item.iron, 60), stack(Item.steel, 20)){ + @Override + public void shoot(Player p){ + float ang = mouseAngle(p); + MathUtils.random.setSeed(Gdx.graphics.getFrameId()); + + bullet(p, p.x, p.y, ang + Mathf.range(8)); + + Effects.effect("shoot2", p.x + vector.x, p.y+vector.y); + } + }, + flamethrower(5, BulletType.flame, "Shoots a stream of fire.", stack(Item.steel, 60), stack(Item.coal, 60)){ + + { + shootsound = "flame2"; + } + + @Override + public void shoot(Player p){ + float ang = mouseAngle(p); + //???? + MathUtils.random.setSeed(Gdx.graphics.getFrameId()); + + bullet(p, p.x, p.y, ang + Mathf.range(12)); } }; - public float reload; - public BulletType type; + float reload; + BulletType type; + public String shootsound = "shoot"; public boolean unlocked; public ItemStack[] requirements; public String description = "no desc for you"; + Vector2 vector = new Vector2(); + private Weapon(float reload, BulletType type, String desc, ItemStack... requirements){ this.reload = reload; this.type = type; @@ -45,7 +89,8 @@ public enum Weapon{ } void bullet(Entity owner, float x, float y, float angle){ - new Bullet(type, owner, x, y, angle).add(); + vector.set(3, 0).rotate(mouseAngle(owner)); + new Bullet(type, owner, x+vector.x, y+vector.y, angle).add(); } private static ItemStack stack(Item item, int amount){ diff --git a/core/src/io/anuke/mindustry/ui/UpgradeDialog.java b/core/src/io/anuke/mindustry/ui/UpgradeDialog.java index 4f8a2e51a1..abc1ef18b8 100644 --- a/core/src/io/anuke/mindustry/ui/UpgradeDialog.java +++ b/core/src/io/anuke/mindustry/ui/UpgradeDialog.java @@ -8,6 +8,7 @@ import io.anuke.mindustry.Inventory; import io.anuke.mindustry.entities.Weapon; import io.anuke.mindustry.resource.ItemStack; import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.Effects; import io.anuke.ucore.scene.event.Touchable; import io.anuke.ucore.scene.ui.*; import io.anuke.ucore.scene.ui.layout.Table; @@ -37,6 +38,7 @@ public class UpgradeDialog extends Dialog{ weptab.background("button"); weptab.pad(20); + int i = 0; for(Weapon weapon : Weapon.values()){ TextButton button = new TextButton(weapon.name()); @@ -60,8 +62,12 @@ public class UpgradeDialog extends Dialog{ button.setDisabled(!Inventory.hasItems(weapon.requirements)); }); + if(i > 0 && (i)%2==0) + weptab.row(); - weptab.add(button).width(160); + i++; + + weptab.add(button).width(210); Table tiptable = new Table(); @@ -107,6 +113,7 @@ public class UpgradeDialog extends Dialog{ weapons.put(weapon, true); ui.updateWeapons(); run.run(); + Effects.sound("purchase"); }); }