Added title

This commit is contained in:
Anuken
2017-04-30 17:21:56 -04:00
parent 03c5c889e0
commit dd26e91f24
20 changed files with 130 additions and 96 deletions

BIN
core/assets/music/1.mp3 Normal file

Binary file not shown.

BIN
core/assets/music/2.mp3 Normal file

Binary file not shown.

BIN
core/assets/music/3.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -13,7 +13,7 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import io.anuke.moment.ai.Pathfind; 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.entities.TileEntity;
import io.anuke.moment.resource.ItemStack; import io.anuke.moment.resource.ItemStack;
import io.anuke.moment.world.Tile; import io.anuke.moment.world.Tile;
@@ -39,6 +39,10 @@ public class Control extends RendererModule<Moment>{
cameraScale = 4f; cameraScale = 4f;
setPixelation(); setPixelation();
buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale)); 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 @Override
@@ -170,7 +174,7 @@ public class Control extends RendererModule<Moment>{
//TODO //TODO
if(UInput.keyUp(Keys.G)){ 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(); //new FlameEnemy(0).set(main.player.x, main.player.y).add();
@@ -186,6 +190,7 @@ public class Control extends RendererModule<Moment>{
Effects.effect("place", roundx(), roundy()); Effects.effect("place", roundx(), roundy());
Effects.shake(2f, 2f); Effects.shake(2f, 2f);
USound.play("place");
for(ItemStack stack : main.recipe.requirements){ for(ItemStack stack : main.recipe.requirements){
main.removeItem(stack); main.removeItem(stack);

View File

@@ -12,9 +12,7 @@ import io.anuke.moment.resource.Recipe;
import io.anuke.moment.world.Generator; import io.anuke.moment.world.Generator;
import io.anuke.moment.world.Tile; import io.anuke.moment.world.Tile;
import io.anuke.moment.world.TileType; import io.anuke.moment.world.TileType;
import io.anuke.ucore.core.KeyBinds; import io.anuke.ucore.core.*;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.UInput;
import io.anuke.ucore.entities.Effects; import io.anuke.ucore.entities.Effects;
import io.anuke.ucore.entities.Entities; import io.anuke.ucore.entities.Entities;
import io.anuke.ucore.modules.ModuleController; import io.anuke.ucore.modules.ModuleController;
@@ -42,6 +40,7 @@ public class Moment extends ModuleController<Moment>{
public boolean playing = false; public boolean playing = false;
public boolean paused = false; public boolean paused = false;
public boolean showedTutorial = false;
@Override @Override
public void init(){ public void init(){
@@ -82,9 +81,9 @@ public class Moment extends ModuleController<Moment>{
@Override @Override
public void update(){ public void update(){
if(!paused) if(!paused)
super.update(); super.update();
if(!playing) return; if(!playing || paused) return;
if(UInput.keyUp(Keys.Q)) if(UInput.keyUp(Keys.Q))
System.out.println("Enemies: " + Enemy.amount + " Wavetime: " + wavetime + " Wave: " + wave + " Wavespace: " + wavespace); System.out.println("Enemies: " + Enemy.amount + " Wavetime: " + wavetime + " Wave: " + wave + " Wavespace: " + wavespace);
@@ -99,7 +98,16 @@ public class Moment extends ModuleController<Moment>{
public void play(){ public void play(){
wavetime = waveSpacing(); 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(){ public void restart(){
@@ -127,6 +135,7 @@ public class Moment extends ModuleController<Moment>{
public void coreDestroyed(){ public void coreDestroyed(){
Effects.shake(5, 6); Effects.shake(5, 6);
USound.play("corexplode");
for(int i = 0; i < 16; i ++){ for(int i = 0; i < 16; i ++){
Timers.run(i*2, ()->{ Timers.run(i*2, ()->{
Effects.effect("explosion", core.worldx()+Mathf.range(40), core.worldy()+Mathf.range(40)); Effects.effect("explosion", core.worldx()+Mathf.range(40), core.worldy()+Mathf.range(40));
@@ -173,6 +182,7 @@ public class Moment extends ModuleController<Moment>{
public void runWave(){ public void runWave(){
int amount = wave; int amount = wave;
USound.play("spawn");
for(int i = 0; i < amount; i ++){ for(int i = 0; i < amount; i ++){
int pos = i; int pos = i;

View File

@@ -26,7 +26,7 @@ public class UI extends SceneModule<Moment>{
Table itemtable; Table itemtable;
PrefsDialog prefs; PrefsDialog prefs;
KeybindDialog keys; KeybindDialog keys;
Dialog about, menu, restart; Dialog about, menu, restart, tutorial;
BooleanSupplier play = () -> { BooleanSupplier play = () -> {
return main.playing; return main.playing;
@@ -45,9 +45,16 @@ public class UI extends SceneModule<Moment>{
} }
void drawBackground(){ void drawBackground(){
//float w = gwidth();
//float h = gheight(); Draw.color();
Draw.rect("player", 0, 0, 100, 100); 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 @Override
@@ -116,9 +123,39 @@ public class UI extends SceneModule<Moment>{
keys = new KeybindDialog(); keys = new KeybindDialog();
about = new Dialog("About"); 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(); 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"){ restart = new Dialog("The core was destroyed.", "dialog"){
public Dialog show(Scene scene){ public Dialog show(Scene scene){
super.show(scene); super.show(scene);
@@ -269,6 +306,7 @@ public class UI extends SceneModule<Moment>{
table.add().size(size); table.add().size(size);
} }
//TODO rows
//if((int)((float)recipes.size/rows+1) == 2){ //if((int)((float)recipes.size/rows+1) == 2){
// table.row(); // table.row();
//} //}
@@ -283,64 +321,6 @@ public class UI extends SceneModule<Moment>{
row(); row();
add(stack).colspan(3); 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); get().pad(10f);
}}.right().bottom(); }}.right().bottom();
@@ -395,6 +375,29 @@ public class UI extends SceneModule<Moment>{
get().setVisible(play); get().setVisible(play);
}}.end(); }}.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 //menu table
new table(){{ new table(){{
float w = 200; float w = 200;

View File

@@ -7,6 +7,7 @@ import io.anuke.moment.Moment;
import io.anuke.moment.ai.Pathfind; import io.anuke.moment.ai.Pathfind;
import io.anuke.moment.world.TileType; import io.anuke.moment.world.TileType;
import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.USound;
import io.anuke.ucore.entities.*; import io.anuke.ucore.entities.*;
import io.anuke.ucore.util.Timers; import io.anuke.ucore.util.Timers;
@@ -24,6 +25,7 @@ public class Enemy extends DestructibleEntity{
public BulletType bullet = BulletType.small; public BulletType bullet = BulletType.small;
public float length = 4; public float length = 4;
public float rotatespeed = 8f; public float rotatespeed = 8f;
public String shootsound = "enemyshoot";
public Enemy(int spawn){ public Enemy(int spawn){
this.spawn = spawn; this.spawn = spawn;
@@ -46,13 +48,16 @@ public class Enemy extends DestructibleEntity{
target = TileType.findTileTarget(x, y, null, range, false); target = TileType.findTileTarget(x, y, null, range, false);
if(target != null){ if(target != null){
if(Timers.get(this, reload)) if(Timers.get(this, reload)){
shoot(); shoot();
USound.play(shootsound);
}
} }
} }
public void shoot(){ public void shoot(){
vector.set(length, 0).rotate(direction.angle()); vector.set(length, 0).rotate(direction.angle());
new Bullet(bullet, this, x+vector.x, y+vector.y, direction.angle()).add(); 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(){ public void onDeath(){
Effects.effect("explosion", this); Effects.effect("explosion", this);
Effects.shake(3f, 4f); Effects.shake(3f, 4f);
USound.play("explosion");
remove(); remove();
} }

View File

@@ -6,11 +6,13 @@ public class FlameEnemy extends Enemy{
public FlameEnemy(int spawn) { public FlameEnemy(int spawn) {
super(spawn); super(spawn);
speed = 0.3f;
speed = 0.35f;
maxhealth = 150; maxhealth = 150;
reload = 6; reload = 6;
bullet = BulletType.flameshot; bullet = BulletType.flameshot;
shootsound = "flame";
range = 40; range = 40;

View File

@@ -8,6 +8,7 @@ import io.anuke.moment.Moment;
import io.anuke.moment.UI; import io.anuke.moment.UI;
import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.UInput; import io.anuke.ucore.core.UInput;
import io.anuke.ucore.core.USound;
import io.anuke.ucore.entities.DestructibleEntity; import io.anuke.ucore.entities.DestructibleEntity;
import io.anuke.ucore.entities.Effects; import io.anuke.ucore.entities.Effects;
import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Angles;
@@ -72,6 +73,7 @@ public class Player extends DestructibleEntity{
if(shooting && reload <= 0){ if(shooting && reload <= 0){
weapon.shoot(this); weapon.shoot(this);
USound.play("shoot");
reload = weapon.reload; reload = weapon.reload;
} }

View File

@@ -8,6 +8,7 @@ import io.anuke.moment.ai.Pathfind;
import io.anuke.moment.resource.Item; import io.anuke.moment.resource.Item;
import io.anuke.moment.world.Tile; import io.anuke.moment.world.Tile;
import io.anuke.moment.world.TileType; import io.anuke.moment.world.TileType;
import io.anuke.ucore.core.USound;
import io.anuke.ucore.entities.Effects; import io.anuke.ucore.entities.Effects;
import io.anuke.ucore.entities.Entity; import io.anuke.ucore.entities.Entity;
@@ -40,6 +41,8 @@ public class TileEntity extends Entity{
Pathfind.updatePath(); Pathfind.updatePath();
Effects.shake(4f, 4f); Effects.shake(4f, 4f);
Effects.effect("explosion", this); Effects.effect("explosion", this);
USound.play("break");
} }
public void collision(Bullet other){ public void collision(Bullet other){

View File

@@ -7,28 +7,28 @@ import com.badlogic.gdx.utils.Array;
import io.anuke.moment.world.TileType; import io.anuke.moment.world.TileType;
public enum Recipe{ public enum Recipe{
stonewall(distribution, TileType.stonewall, stack(Item.stone, 4)), stonewall(distribution, TileType.stonewall, stack(Item.stone, 5)),
ironwall(distribution, TileType.ironwall, stack(Item.iron, 4)), ironwall(distribution, TileType.ironwall, stack(Item.iron, 5)),
steelwall(distribution, TileType.steelwall, stack(Item.steel, 4)), steelwall(distribution, TileType.steelwall, stack(Item.steel, 5)),
conveyor(distribution, TileType.conveyor, stack(Item.stone, 1)), conveyor(distribution, TileType.conveyor, stack(Item.stone, 1)),
fastconveyor(distribution, TileType.steelconveyor, stack(Item.steel, 1)), fastconveyor(distribution, TileType.steelconveyor, stack(Item.steel, 1)),
router(distribution, TileType.router, stack(Item.stone, 3)), router(distribution, TileType.router, stack(Item.stone, 3)),
turret(defense, TileType.turret, stack(Item.stone, 4)), turret(defense, TileType.turret, stack(Item.stone, 8)),
dturret(defense, TileType.doubleturret, stack(Item.stone, 6)), dturret(defense, TileType.doubleturret, stack(Item.stone, 12)),
machineturret(defense, TileType.machineturret, stack(Item.iron, 10), stack(Item.stone, 6)), machineturret(defense, TileType.machineturret, stack(Item.iron, 15), stack(Item.stone, 20)),
shotgunturret(defense, TileType.shotgunturret, stack(Item.iron, 10), stack(Item.steel, 8)), shotgunturret(defense, TileType.shotgunturret, stack(Item.iron, 15), stack(Item.steel, 24)),
flameturret(defense, TileType.flameturret, stack(Item.iron, 12), stack(Item.steel, 12)), flameturret(defense, TileType.flameturret, stack(Item.iron, 25), stack(Item.steel, 18)),
sniperturret(defense, TileType.sniperturret, stack(Item.iron, 15), stack(Item.steel, 20)), sniperturret(defense, TileType.sniperturret, stack(Item.iron, 30), stack(Item.steel, 20)),
healturret(defense, TileType.healturret, stack(Item.iron, 40)), healturret(defense, TileType.healturret, stack(Item.iron, 40)),
megahealturret(defense, TileType.megahealturret, stack(Item.iron, 30), stack(Item.steel, 40)), megahealturret(defense, TileType.megahealturret, stack(Item.iron, 30), stack(Item.steel, 40)),
drill(production, TileType.stonedrill, stack(Item.stone, 5)), drill(production, TileType.stonedrill, stack(Item.stone, 6)),
irondrill(production, TileType.irondrill, stack(Item.stone, 30)), irondrill(production, TileType.irondrill, stack(Item.stone, 40)),
coaldrill(production, TileType.coaldrill, stack(Item.stone, 30), stack(Item.iron, 30)), coaldrill(production, TileType.coaldrill, stack(Item.stone, 40), stack(Item.iron, 40)),
smelter(production, TileType.smelter, stack(Item.stone, 40), stack(Item.iron, 40)); smelter(production, TileType.smelter, stack(Item.stone, 80), stack(Item.iron, 80));
public TileType result; public TileType result;
public ItemStack[] requirements; public ItemStack[] requirements;

View File

@@ -10,6 +10,7 @@ import io.anuke.moment.entities.*;
import io.anuke.moment.entities.TileEntity.ItemPos; import io.anuke.moment.entities.TileEntity.ItemPos;
import io.anuke.moment.resource.Item; import io.anuke.moment.resource.Item;
import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.USound;
import io.anuke.ucore.entities.*; import io.anuke.ucore.entities.*;
import io.anuke.ucore.graphics.Hue; import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Angles;
@@ -330,11 +331,11 @@ public enum TileType{
}, },
flameturret(true, true, false){ flameturret(true, true, false){
{ {
range = 30f; range = 35f;
reload = 6f; reload = 5f;
bullet = BulletType.flame; bullet = BulletType.flame;
ammo = Item.coal; ammo = Item.coal;
health = 75; health = 85;
} }
public void update(Tile tile){ public void update(Tile tile){
@@ -380,7 +381,7 @@ public enum TileType{
}, },
shotgunturret(true, true, false){ shotgunturret(true, true, false){
{ {
range = 65; range = 50;
reload = 40f; reload = 40f;
bullet = BulletType.iron; bullet = BulletType.iron;
ammo = Item.iron; ammo = Item.iron;
@@ -405,10 +406,11 @@ public enum TileType{
@Override @Override
void shoot(Tile tile){ void shoot(Tile tile){
vector.set(0, 4).setAngle(tile.entity.rotation);
for(int i = 0; i < 6; i ++) for(int i = 0; i < 6; i ++)
Timers.run(i, ()->{ Timers.run(i/1.5f, ()->{
bullet(tile, tile.entity.rotation + Mathf.range(6)); 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){ megahealturret(true, true, false){
{ {
range = 30; range = 30;
reload = 25f; reload = 20f;
health = 60; health = 80;
} }
public void update(Tile tile){ public void update(Tile tile){
@@ -562,6 +564,7 @@ public enum TileType{
if(enemy != null){ 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); 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)){ if(Timers.get(tile, reload)){
USound.play("shoot");
shoot(tile); shoot(tile);
tile.entity.shots--; tile.entity.shots--;
} }