This commit is contained in:
Anuken
2017-04-30 17:56:51 -04:00
parent dd26e91f24
commit 42c2ea68f1
7 changed files with 47 additions and 20 deletions

View File

@ -61,7 +61,7 @@ project(":core") {
dependencies { dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:1.8.1" compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
//compile fileTree(dir: '../core/lib', include: '*.jar') compile fileTree(dir: '../core/lib', include: '*.jar')
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

View File

@ -12,8 +12,8 @@ import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import io.anuke.gif.GifRecorder;
import io.anuke.moment.ai.Pathfind; import io.anuke.moment.ai.Pathfind;
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;
@ -29,7 +29,7 @@ import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Timers; import io.anuke.ucore.util.Timers;
public class Control extends RendererModule<Moment>{ public class Control extends RendererModule<Moment>{
//GifRecorder recorder = new GifRecorder(batch); GifRecorder recorder = new GifRecorder(batch);
int rangex = 10, rangey = 10; int rangex = 10, rangey = 10;
float breaktime = 0; float breaktime = 0;
float breakdur = 50; float breakdur = 50;
@ -173,9 +173,9 @@ public class Control extends RendererModule<Moment>{
} }
//TODO //TODO
if(UInput.keyUp(Keys.G)){ //if(UInput.keyUp(Keys.G)){
new Enemy(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();
if(UInput.buttonUp(Buttons.LEFT) && main.recipe != null && validPlace(tilex(), tiley(), main.recipe.result) && !get(UI.class).hasMouse()){ if(UInput.buttonUp(Buttons.LEFT) && main.recipe != null && validPlace(tilex(), tiley(), main.recipe.result) && !get(UI.class).hasMouse()){
@ -218,6 +218,7 @@ public class Control extends RendererModule<Moment>{
tile.setBlock(TileType.air); tile.setBlock(TileType.air);
Pathfind.updatePath(); Pathfind.updatePath();
breaktime = 0f; breaktime = 0f;
USound.play("break");
} }
}else{ }else{
breaktime = 0f; breaktime = 0f;
@ -289,7 +290,7 @@ public class Control extends RendererModule<Moment>{
drawDefault(); drawDefault();
//recorder.update(); recorder.update();
} }
@Override @Override

View File

@ -12,7 +12,9 @@ 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.*; import io.anuke.ucore.core.KeyBinds;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.USound;
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;
@ -85,13 +87,13 @@ public class Moment extends ModuleController<Moment>{
if(!playing || paused) 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);
if(Enemy.amount <= 0) if(Enemy.amount <= 0)
wavetime -= delta(); wavetime -= delta();
if(wavetime <= 0){ if(wavetime <= 0/* || UInput.keyUp(Keys.Q)*/){
runWave(); runWave();
} }
} }
@ -125,9 +127,9 @@ public class Moment extends ModuleController<Moment>{
items.put(Item.stone, 20); items.put(Item.stone, 20);
//items.put(Item.stone, 200); items.put(Item.stone, 2000);
//items.put(Item.iron, 200); items.put(Item.iron, 2000);
//items.put(Item.steel, 200); items.put(Item.steel, 2000);
if(get(UI.class).about != null) if(get(UI.class).about != null)
get(UI.class).updateItems(); get(UI.class).updateItems();

View File

@ -6,6 +6,9 @@ import java.util.function.BooleanSupplier;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureWrap;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import io.anuke.moment.entities.Enemy; import io.anuke.moment.entities.Enemy;
@ -21,12 +24,14 @@ import io.anuke.ucore.scene.ui.*;
import io.anuke.ucore.scene.ui.layout.Stack; import io.anuke.ucore.scene.ui.layout.Stack;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Timers;
public class UI extends SceneModule<Moment>{ public class UI extends SceneModule<Moment>{
Table itemtable; Table itemtable;
PrefsDialog prefs; PrefsDialog prefs;
KeybindDialog keys; KeybindDialog keys;
Dialog about, menu, restart, tutorial; Dialog about, menu, restart, tutorial;
Texture conveyor = new Texture("sprites/conveyor.png"), conveyort = new Texture("sprites/conveyort.png");
BooleanSupplier play = () -> { BooleanSupplier play = () -> {
return main.playing; return main.playing;
@ -42,18 +47,36 @@ public class UI extends SceneModule<Moment>{
Dialog.closePadR = -1; Dialog.closePadR = -1;
Dialog.closePadT = 4; Dialog.closePadT = 4;
conveyor.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
conveyort.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
} }
void drawBackground(){ void drawBackground(){
Batch batch = scene.getBatch();
Draw.color(); Draw.color();
float w = gwidth(); int w = gwidth();
float h = gheight(); int h = gheight();
batch.draw(conveyor, 0, 0, (int)Timers.time(), 0, w, h);
int tw = w/64+1;//, th = h/64+1;
for(int x = 0; x < tw; x ++){
batch.draw(conveyort, x*64, 0, 0, (int)Timers.time(), 32, h);
}
Draw.tscl(1.5f); Draw.tscl(1.5f);
Draw.text("[DARK_GRAY]-( Mindustry )-", w/2, h-16); Draw.text("[DARK_GRAY]-( Mindustry )-", w/2, h-16);
Draw.text("[#f1de60]-( Mindustry )-", w/2, h-10); Draw.text("[#f1de60]-( Mindustry )-", w/2, h-10);
Draw.tscl(0.5f); Draw.tscl(0.5f);
//Draw.rect("conveyor", w/2, h/2, 1000, 1000); //Draw.rect("conveyor", w/2, h/2, 1000, 1000);
} }
@ -306,10 +329,11 @@ 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(sec == Section.distribution){
// table.row(); table.row();
//} table.add().size(size);
}
table.setVisible(()->{ table.setVisible(()->{
return button.isChecked(); return button.isChecked();