Various additions
This commit is contained in:
@@ -88,6 +88,13 @@ public class Control extends RendererModule<Moment>{
|
||||
Draw.circle(e.x, e.y, 3f + e.ifract() * 3f);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("spawn", 23, e -> {
|
||||
Draw.thickness(2f);
|
||||
Draw.color(Hue.mix(Color.DARK_GRAY, Color.SCARLET, e.ifract()));
|
||||
Draw.circle(e.x, e.y, 7f - e.ifract() * 6f);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("ind", 100, e -> {
|
||||
Draw.thickness(3f);
|
||||
@@ -210,10 +217,16 @@ public class Control extends RendererModule<Moment>{
|
||||
return Mathf.scl2(UGraphics.mouseWorldPos().y, TileType.tilesize);
|
||||
}
|
||||
|
||||
boolean validPlace(int x, int y, TileType tile){
|
||||
boolean validPlace(int x, int y, TileType type){
|
||||
|
||||
if(!cursorNear())
|
||||
return false;
|
||||
|
||||
for(Tile spawn : main.spawnpoints){
|
||||
if(Vector2.dst(x * tilesize, y * tilesize, spawn.worldx(), spawn.worldy()) < main.spawnspace){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(SolidEntity e : Entities.getNearby(x * tilesize, y * tilesize, tilesize * 2f)){
|
||||
Rectangle.tmp.setSize(e.hitsize);
|
||||
@@ -223,7 +236,7 @@ public class Control extends RendererModule<Moment>{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return main.tiles[x][y].block() == TileType.air;
|
||||
return main.tile(x, y).block() == TileType.air;
|
||||
}
|
||||
|
||||
boolean cursorNear(){
|
||||
@@ -234,7 +247,12 @@ public class Control extends RendererModule<Moment>{
|
||||
public void update(){
|
||||
if(Gdx.input.isKeyJustPressed(Keys.ESCAPE))
|
||||
Gdx.app.exit();
|
||||
|
||||
|
||||
if(!main.playing){
|
||||
clearScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.update();
|
||||
|
||||
input();
|
||||
@@ -312,11 +330,19 @@ public class Control extends RendererModule<Moment>{
|
||||
vector.set(7, 0).rotate(main.rotation * 90);
|
||||
Draw.line(x, y, x + vector.x, y + vector.y);
|
||||
}
|
||||
|
||||
Draw.thickness(1f);
|
||||
Draw.color("scarlet");
|
||||
for(Tile spawn : main.spawnpoints){
|
||||
Draw.dashcircle(spawn.worldx(), spawn.worldy(), main.spawnspace);
|
||||
}
|
||||
|
||||
if(valid)
|
||||
Cursors.setHand();
|
||||
else
|
||||
Cursors.restoreCursor();
|
||||
|
||||
Draw.clear();
|
||||
}
|
||||
|
||||
//block breaking
|
||||
|
||||
@@ -15,6 +15,7 @@ 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.entities.Effects;
|
||||
import io.anuke.ucore.modules.ModuleController;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Timers;
|
||||
@@ -31,10 +32,13 @@ public class Moment extends ModuleController<Moment>{
|
||||
public float placerange = 60;
|
||||
|
||||
public int wave = 1;
|
||||
public float wavespace = 2000/100;
|
||||
public float wavespace = 1000;
|
||||
public float wavetime = wavespace;
|
||||
public float spawnspace = 65;
|
||||
public Tile core;
|
||||
public Array<Tile> spawnpoints = new Array<Tile>();
|
||||
|
||||
public boolean playing = false;
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
@@ -78,14 +82,20 @@ public class Moment extends ModuleController<Moment>{
|
||||
public void update(){
|
||||
super.update();
|
||||
|
||||
if(!playing) return;
|
||||
|
||||
if(Enemy.amount == 0)
|
||||
wavetime -= delta();
|
||||
wavetime -= delta();
|
||||
|
||||
if(wavetime < 0 || UInput.keyUp(Keys.F)){
|
||||
runWave();
|
||||
}
|
||||
}
|
||||
|
||||
public void play(){
|
||||
playing = true;
|
||||
}
|
||||
|
||||
public void coreDestroyed(){
|
||||
//TODO "you lose" message or something
|
||||
}
|
||||
@@ -126,7 +136,9 @@ public class Moment extends ModuleController<Moment>{
|
||||
Tile tile = spawnpoints.get(point);
|
||||
|
||||
Timers.run((int)(i/spawnpoints.size)*40f, ()->{
|
||||
new Enemy(point).set(tile.worldx(), tile.worldy()).add();
|
||||
Enemy e = new Enemy(point).set(tile.worldx(), tile.worldy());
|
||||
Effects.effect("spawn", e);
|
||||
e.add();
|
||||
});
|
||||
|
||||
}
|
||||
@@ -140,10 +152,6 @@ public class Moment extends ModuleController<Moment>{
|
||||
return tiles[x][y];
|
||||
}
|
||||
|
||||
public Tile spawn(){
|
||||
return tiles[size/2][size-1];
|
||||
}
|
||||
|
||||
public void addItem(Item item, int amount){
|
||||
items.put(item, items.get(item, 0)+amount);
|
||||
get(UI.class).updateItems();
|
||||
|
||||
@@ -2,13 +2,13 @@ package io.anuke.moment;
|
||||
|
||||
import static io.anuke.moment.world.TileType.tilesize;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.moment.entities.Enemy;
|
||||
import io.anuke.moment.resource.Item;
|
||||
import io.anuke.moment.resource.ItemStack;
|
||||
import io.anuke.moment.resource.Recipe;
|
||||
import io.anuke.moment.resource.*;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
@@ -17,60 +17,197 @@ import io.anuke.ucore.modules.SceneModule;
|
||||
import io.anuke.ucore.scene.builders.*;
|
||||
import io.anuke.ucore.scene.style.Styles;
|
||||
import io.anuke.ucore.scene.ui.*;
|
||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class UI extends SceneModule<Moment>{
|
||||
Table itemtable;
|
||||
|
||||
public UI(){
|
||||
PrefsDialog prefs;
|
||||
KeybindDialog keys;
|
||||
Dialog about;
|
||||
|
||||
BooleanSupplier play = () -> {
|
||||
return main.playing;
|
||||
};
|
||||
|
||||
BooleanSupplier nplay = () -> {
|
||||
return !main.playing;
|
||||
};
|
||||
|
||||
public UI() {
|
||||
Styles.styles.font().setUseIntegerPositions(false);
|
||||
TooltipManager.getInstance().animations = false;
|
||||
|
||||
Dialog.closePadR = -1;
|
||||
Dialog.closePadT = 4;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
scene.getBatch().setProjectionMatrix(get(Control.class).camera.combined);
|
||||
scene.getBatch().begin();
|
||||
Tile tile = main.tiles[tilex()][tiley()];
|
||||
if(tile.block() != TileType.air){
|
||||
String error = tile.block().error(tile);
|
||||
if(error != null){
|
||||
Draw.tcolor(Color.SCARLET);
|
||||
Draw.tscl(1/8f);
|
||||
Draw.text(error, tile.worldx(), tile.worldy()+tilesize);
|
||||
|
||||
}else if(tile.block().name().contains("turret")){
|
||||
Draw.tscl(1/8f);
|
||||
Draw.tcolor(Color.GREEN);
|
||||
Draw.text("Ammo: " + tile.entity.shots, tile.worldx(), tile.worldy()-tilesize);
|
||||
|
||||
if(main.playing){
|
||||
scene.getBatch().setProjectionMatrix(get(Control.class).camera.combined);
|
||||
scene.getBatch().begin();
|
||||
Tile tile = main.tiles[tilex()][tiley()];
|
||||
if(tile.block() != TileType.air){
|
||||
String error = tile.block().error(tile);
|
||||
if(error != null){
|
||||
Draw.tcolor(Color.SCARLET);
|
||||
Draw.tscl(1 / 8f);
|
||||
Draw.text(error, tile.worldx(), tile.worldy() + tilesize);
|
||||
|
||||
}else if(tile.block().name().contains("turret")){
|
||||
Draw.tscl(1 / 8f);
|
||||
Draw.tcolor(Color.GREEN);
|
||||
Draw.text("Ammo: " + tile.entity.shots, tile.worldx(), tile.worldy() - tilesize);
|
||||
}
|
||||
|
||||
Draw.tscl(0.5f);
|
||||
Draw.clear();
|
||||
}
|
||||
scene.getBatch().end();
|
||||
}else{
|
||||
|
||||
Draw.tscl(0.5f);
|
||||
Draw.clear();
|
||||
}
|
||||
scene.getBatch().end();
|
||||
|
||||
super.update();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
|
||||
|
||||
prefs = new PrefsDialog("Settings");
|
||||
|
||||
prefs.sliderPref("screenshake", "Screen Shake", 4, 0, 12, i -> {
|
||||
return (i / 4f) + "x";
|
||||
});
|
||||
|
||||
/*
|
||||
* prefs.sliderPref("difficulty", "Difficulty", 1, 0, 3, i->{ return
|
||||
* (i/3f) + "x"; });
|
||||
*/
|
||||
|
||||
keys = new KeybindDialog();
|
||||
|
||||
about = new Dialog("About");
|
||||
about.getContentTable().add("Made by Anuken for the" + "\nGDL Metal Monstrosity jam." + "\nTools used:");
|
||||
about.addCloseButton();
|
||||
|
||||
build.begin(scene);
|
||||
|
||||
|
||||
new table(){{
|
||||
abottom();
|
||||
aright();
|
||||
|
||||
|
||||
new table(){{
|
||||
|
||||
|
||||
get().background("button");
|
||||
|
||||
int rows = 3;
|
||||
int maxcol = 0;
|
||||
float size = 46;
|
||||
|
||||
Stack stack = new Stack();
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
Array<Recipe> recipes = new Array<Recipe>();
|
||||
|
||||
for(Section sec : Section.values()){
|
||||
recipes.clear();
|
||||
Recipe.getBy(sec, recipes);
|
||||
maxcol = Math.max((int)((float)recipes.size/rows+1), maxcol);
|
||||
}
|
||||
|
||||
|
||||
for(Section sec : Section.values()){
|
||||
recipes.clear();
|
||||
Recipe.getBy(sec, recipes);
|
||||
|
||||
ImageButton button = new ImageButton("icon-"+sec.name(), "toggle");
|
||||
add(button).size(size).height(size+8);
|
||||
button.getImageCell().size(40).padBottom(4);
|
||||
group.add(button);
|
||||
|
||||
Table table = new Table();
|
||||
|
||||
int i = 0;
|
||||
|
||||
for(Recipe r : recipes){
|
||||
ImageButton image = new ImageButton(Draw.region(r.result.name()), "select");
|
||||
|
||||
image.clicked(()->{
|
||||
main.recipe = r;
|
||||
});
|
||||
|
||||
table.add(image).size(size+8).pad(4);
|
||||
image.getImageCell().size(size);
|
||||
|
||||
image.update(()->{
|
||||
image.setChecked(main.recipe == r);
|
||||
image.setDisabled(!main.hasItems(r.requirements));
|
||||
});
|
||||
|
||||
if(i % rows == rows-1)
|
||||
table.row();
|
||||
|
||||
i++;
|
||||
|
||||
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.75f).left().padBottom(2f);
|
||||
|
||||
ItemStack[] req = r.requirements;
|
||||
for(ItemStack s : req){
|
||||
tiptable.row();
|
||||
tiptable.add("[YELLOW]" + s.amount + "x " + s.item.name(), 0.5f).left();
|
||||
}
|
||||
|
||||
tiptable.row();
|
||||
tiptable.add().size(10);
|
||||
tiptable.row();
|
||||
tiptable.add("[ORANGE]" + description).left();
|
||||
tiptable.pad(10f);
|
||||
|
||||
Tooltip tip = new Tooltip(tiptable);
|
||||
tip.setInstant(true);
|
||||
|
||||
image.addListener(tip);
|
||||
}
|
||||
|
||||
//additional padding
|
||||
for(int j = 0; j < maxcol - (int)((float)recipes.size/rows+1); j ++){
|
||||
table.row();
|
||||
table.add().size(size);
|
||||
}
|
||||
|
||||
table.setVisible(()->{
|
||||
return button.isChecked();
|
||||
});
|
||||
|
||||
stack.add(table);
|
||||
}
|
||||
|
||||
|
||||
row();
|
||||
add(stack).colspan(3);
|
||||
|
||||
/*
|
||||
for(Recipe r : Recipe.values()){
|
||||
Image image = new Image(Draw.region(r.result.name()));
|
||||
|
||||
new button(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();
|
||||
@@ -84,98 +221,131 @@ public class UI extends SceneModule<Moment>{
|
||||
ItemStack[] req = r.requirements;
|
||||
for(ItemStack stack : req){
|
||||
table.row();
|
||||
table.add("[YELLOW]"+stack.amount +"x " +stack.item.name()).left();
|
||||
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.add("[PURPLE]" + r.result.name(), 0.5f).left().padBottom(2f);
|
||||
tiptable.row();
|
||||
tiptable.add("[ORANGE]"+description).left();
|
||||
tiptable.pad(8f);
|
||||
|
||||
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().update(() -> {
|
||||
get().setDisabled(!main.hasItems(current.requirements));
|
||||
//get().setTouchable(!main.hasItems(current.requirements) ? Touchable.disabled : Touchable.enabled);
|
||||
});
|
||||
|
||||
}}.width(220f);
|
||||
|
||||
}}.width(234f);
|
||||
|
||||
row();
|
||||
//row();
|
||||
}
|
||||
|
||||
get().pad(20f);
|
||||
*/
|
||||
|
||||
get().pad(10f);
|
||||
|
||||
}}.right().bottom();
|
||||
|
||||
|
||||
get().setVisible(play);
|
||||
|
||||
}}.end();
|
||||
|
||||
|
||||
new table(){{
|
||||
atop();
|
||||
aleft();
|
||||
itemtable = new table().top().left().get();
|
||||
itemtable.background("button");
|
||||
|
||||
get().setVisible(play);
|
||||
}}.end();
|
||||
|
||||
|
||||
//wave table...
|
||||
new table(){{
|
||||
atop();
|
||||
aright();
|
||||
|
||||
|
||||
new table(){{
|
||||
get().background("button");
|
||||
|
||||
new label("Wave 1"){{
|
||||
get().setFontScale(1f);
|
||||
get().update(()->{
|
||||
get().setText("[YELLOW]Wave " + Moment.i.wave);
|
||||
});
|
||||
}}.left();
|
||||
|
||||
row();
|
||||
|
||||
new label("Time"){{
|
||||
get().update(()->{
|
||||
get().setText(Enemy.amount > 0 ?
|
||||
Enemy.amount+" Enemies remaining" : "New wave in " + (int)(main.wavetime/60f));
|
||||
});
|
||||
}}.minWidth(150);
|
||||
|
||||
get().pad(8);
|
||||
}};
|
||||
get().background("button");
|
||||
|
||||
new label("Wave 1"){{
|
||||
get().setFontScale(1f);
|
||||
get().update(() -> {
|
||||
get().setText("[YELLOW]Wave " + Moment.i.wave);
|
||||
});
|
||||
}}.left();
|
||||
|
||||
row();
|
||||
|
||||
new label("Time"){{
|
||||
get().update(() -> {
|
||||
get().setText(Enemy.amount > 0 ? Enemy.amount + " Enemies remaining" : "New wave in " + (int) (main.wavetime / 60f));
|
||||
});
|
||||
}}.minWidth(150);
|
||||
|
||||
get().pad(12);
|
||||
}};
|
||||
|
||||
get().setVisible(play);
|
||||
}}.end();
|
||||
|
||||
|
||||
|
||||
//menu table
|
||||
new table(){{
|
||||
float w = 200;
|
||||
|
||||
new button("Play", () -> {
|
||||
main.play();
|
||||
}).width(w);
|
||||
|
||||
row();
|
||||
|
||||
new button("Settings", () -> {
|
||||
prefs.show(scene);
|
||||
}).width(w);
|
||||
|
||||
row();
|
||||
|
||||
new button("Controls", () -> {
|
||||
keys.show(scene);
|
||||
}).width(w);
|
||||
|
||||
row();
|
||||
|
||||
new button("About", () -> {
|
||||
about.show(scene);
|
||||
}).width(w);
|
||||
|
||||
get().setVisible(nplay);
|
||||
}};
|
||||
|
||||
updateItems();
|
||||
|
||||
|
||||
build.end();
|
||||
}
|
||||
|
||||
|
||||
public void updateItems(){
|
||||
itemtable.clear();
|
||||
|
||||
|
||||
for(Item stack : main.items.keys()){
|
||||
Image image = new Image(Draw.region("icon-" + stack.name()));
|
||||
Label label = new Label(""+ main.items.get(stack));
|
||||
Label label = new Label("" + main.items.get(stack));
|
||||
label.setFontScale(1f);
|
||||
itemtable.add(image).size(32);
|
||||
itemtable.add(label);
|
||||
itemtable.row();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float roundx(){
|
||||
return Mathf.round2(UGraphics.mouseWorldPos().x, TileType.tilesize);
|
||||
}
|
||||
|
||||
@@ -1,34 +1,54 @@
|
||||
package io.anuke.moment.resource;
|
||||
|
||||
import static io.anuke.moment.resource.Section.*;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.moment.world.TileType;
|
||||
|
||||
public enum Recipe{
|
||||
stonewall(TileType.stonewall, stack(Item.stone, 4)),
|
||||
ironwall(TileType.ironwall, stack(Item.iron, 4)),
|
||||
drill(TileType.stonedrill, stack(Item.stone, 5)),
|
||||
irondrill(TileType.irondrill, stack(Item.stone, 30)),
|
||||
coaldrill(TileType.coaldrill, stack(Item.stone, 30), stack(Item.iron, 30)),
|
||||
conveyor(TileType.conveyor, stack(Item.stone, 1)),
|
||||
fastconveyor(TileType.steelconveyor, stack(Item.steel, 1)),
|
||||
router(TileType.router, stack(Item.stone, 3)),
|
||||
smelter(TileType.smelter, stack(Item.stone, 40), stack(Item.iron, 40)),
|
||||
healturret(TileType.healturret, stack(Item.iron, 20)),
|
||||
turret(TileType.turret, stack(Item.stone, 4)),
|
||||
dturret(TileType.doubleturret, stack(Item.stone, 6)),
|
||||
machineturret(TileType.machineturret, stack(Item.iron, 10), stack(Item.stone, 6)),
|
||||
shotgunturret(TileType.shotgunturret, stack(Item.iron, 10), stack(Item.steel, 8)),
|
||||
flameturret(TileType.flameturret, stack(Item.iron, 12), stack(Item.steel, 12)),
|
||||
sniperturret(TileType.sniperturret, stack(Item.iron, 15), stack(Item.steel, 20));
|
||||
stonewall(distribution, TileType.stonewall, stack(Item.stone, 4)),
|
||||
ironwall(distribution, TileType.ironwall, stack(Item.iron, 4)),
|
||||
steelwall(distribution, TileType.steelwall, stack(Item.steel, 4)),
|
||||
conveyor(distribution, TileType.conveyor, stack(Item.stone, 1)),
|
||||
fastconveyor(distribution, TileType.steelconveyor, stack(Item.steel, 1)),
|
||||
router(distribution, TileType.router, stack(Item.stone, 3)),
|
||||
|
||||
healturret(defense, TileType.healturret, stack(Item.iron, 30)),
|
||||
megahealturret(defense, TileType.megahealturret, stack(Item.iron, 30), stack(Item.steel, 30)),
|
||||
|
||||
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)),
|
||||
|
||||
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));
|
||||
|
||||
public TileType result;
|
||||
public ItemStack[] requirements;
|
||||
public Section section;
|
||||
|
||||
private Recipe(TileType result, ItemStack... requirements){
|
||||
private Recipe(Section section, TileType result, ItemStack... requirements){
|
||||
this.result = result;
|
||||
this.requirements = requirements;
|
||||
this.section = section;
|
||||
}
|
||||
|
||||
private static ItemStack stack(Item item, int amount){
|
||||
return new ItemStack(item, amount);
|
||||
}
|
||||
|
||||
public static Array<Recipe> getBy(Section section, Array<Recipe> r){
|
||||
for(Recipe recipe : Recipe.values()){
|
||||
if(recipe.section == section)
|
||||
r.add(recipe);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
5
core/src/io/anuke/moment/resource/Section.java
Normal file
5
core/src/io/anuke/moment/resource/Section.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package io.anuke.moment.resource;
|
||||
|
||||
public enum Section{
|
||||
defense, production, distribution;
|
||||
}
|
||||
@@ -22,16 +22,16 @@ public enum TileType{
|
||||
public void draw(Tile tile){
|
||||
}
|
||||
},
|
||||
grass, stone, dirt, iron, coal, dirtblock(true), stoneblock(true), stonewall(true, true){
|
||||
{
|
||||
health = 50;
|
||||
}
|
||||
},
|
||||
ironwall(true, true){
|
||||
{
|
||||
health = 80;
|
||||
}
|
||||
},
|
||||
grass,
|
||||
stone,
|
||||
dirt,
|
||||
iron,
|
||||
coal,
|
||||
dirtblock(true),
|
||||
stoneblock(true),
|
||||
stonewall(true, true){{health = 50;}},
|
||||
ironwall(true, true){{health = 80;}},
|
||||
steelwall(true, true){{health = 110;}},
|
||||
stonedrill(true, true){
|
||||
public void update(Tile tile){
|
||||
|
||||
@@ -416,7 +416,7 @@ public enum TileType{
|
||||
healturret(true, true, false){
|
||||
{
|
||||
range = 30;
|
||||
reload = 30f;
|
||||
reload = 40f;
|
||||
health = 50;
|
||||
}
|
||||
|
||||
@@ -447,17 +447,65 @@ public enum TileType{
|
||||
float x = tile.worldx(), y = tile.worldy();
|
||||
float x2 = tile.entity.link.x, y2 = tile.entity.link.y;
|
||||
|
||||
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time() / 2f) + 1f) / 15f));
|
||||
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time()) + 1f) / 14f));
|
||||
Draw.alpha(0.3f);
|
||||
Draw.thickness(4f);
|
||||
Draw.line(x, y, x2, y2);
|
||||
Draw.thickness(2f);
|
||||
Draw.circle(x2, y2, 2f);
|
||||
Draw.rect("circle", x2, y2, 7f, 7f);
|
||||
Draw.alpha(1f);
|
||||
Draw.thickness(2f);
|
||||
Draw.line(x, y, x2, y2);
|
||||
Draw.thickness(1f);
|
||||
Draw.circle(x2, y2, 1f);
|
||||
Draw.rect("circle", x2, y2, 5f, 5f);
|
||||
Draw.clear();
|
||||
}
|
||||
Draw.rect(name(), tile.worldx(), tile.worldy(), tile.entity.rotation - 90);
|
||||
}
|
||||
|
||||
public String description(){
|
||||
return "Heals nearby tiles.";
|
||||
}
|
||||
},
|
||||
megahealturret(true, true, false){
|
||||
{
|
||||
range = 30;
|
||||
reload = 25f;
|
||||
health = 60;
|
||||
}
|
||||
|
||||
public void update(Tile tile){
|
||||
tile.entity.link = findTileTarget(tile, range);
|
||||
|
||||
if(tile.entity.link != null){
|
||||
tile.entity.rotation = tile.entity.angleTo(tile.entity.link);
|
||||
|
||||
if(Timers.get(tile, reload)){
|
||||
tile.entity.link.health++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(Tile tile){
|
||||
Draw.rect("block", tile.worldx(), tile.worldy());
|
||||
}
|
||||
|
||||
public void drawOver(Tile tile){
|
||||
if(tile.entity.link != null){
|
||||
float x = tile.worldx(), y = tile.worldy();
|
||||
float x2 = tile.entity.link.x, y2 = tile.entity.link.y;
|
||||
|
||||
Draw.color(Hue.rgb(132, 242, 242, (MathUtils.sin(Timers.time()) + 1f) / 13f));
|
||||
Draw.alpha(0.3f);
|
||||
Draw.thickness(4f);
|
||||
Draw.line(x, y, x2, y2);
|
||||
Draw.thickness(2f);
|
||||
Draw.rect("circle", x2, y2, 7f, 7f);
|
||||
Draw.alpha(1f);
|
||||
Draw.thickness(2f);
|
||||
Draw.line(x, y, x2, y2);
|
||||
Draw.thickness(1f);
|
||||
Draw.rect("circle", x2, y2, 5f, 5f);
|
||||
Draw.clear();
|
||||
}
|
||||
Draw.rect(name(), tile.worldx(), tile.worldy(), tile.entity.rotation - 90);
|
||||
@@ -558,7 +606,8 @@ public enum TileType{
|
||||
Array<SolidEntity> array = Entities.getNearby(tile.worldx(), tile.worldy(), 100);
|
||||
|
||||
for(Entity e : array){
|
||||
|
||||
if(e == tile.entity) continue;
|
||||
|
||||
if(e instanceof TileEntity && ((TileEntity) e).health < ((TileEntity) e).tile.block().health){
|
||||
float ndst = Vector2.dst(tile.worldx(), tile.worldy(), e.x, e.y);
|
||||
if(ndst < range && (closest == null || ndst < dst)){
|
||||
|
||||
Reference in New Issue
Block a user