mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 15:02:03 -08:00
Fix more bugs
This commit is contained in:
parent
5c1d7a146b
commit
ece7ad0fd3
6 changed files with 39 additions and 11 deletions
|
|
@ -66,9 +66,7 @@ public class Enemy extends DestructibleEntity{
|
|||
Tile core = Vars.control.getCore();
|
||||
|
||||
if(idletime > maxIdleLife){
|
||||
Effects.effect(Fx.shellsmoke, this);
|
||||
Effects.effect(Fx.explosion, this);
|
||||
remove();
|
||||
onDeath();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +237,7 @@ public class Enemy extends DestructibleEntity{
|
|||
|
||||
float minv = 0.08f;
|
||||
|
||||
if(xvelocity < minv && yvelocity < minv && node > 0){
|
||||
if(xvelocity < minv && yvelocity < minv && node > 0 && target == null){
|
||||
idletime += Timers.delta();
|
||||
}else{
|
||||
idletime = 0;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import io.anuke.ucore.scene.ui.Image;
|
|||
|
||||
public class MenuButton extends Button{
|
||||
|
||||
public MenuButton(String icon, Listenable clicked){
|
||||
public MenuButton(String icon, PressGroup group, Listenable clicked){
|
||||
super("menu");
|
||||
Image image = new Image(icon);
|
||||
image.setScaling(Scaling.fit);
|
||||
|
|
@ -17,5 +17,6 @@ public class MenuButton extends Button{
|
|||
image.setOrigin(Align.center);
|
||||
add(image);
|
||||
clicked(clicked);
|
||||
group.add(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@ import static io.anuke.mindustry.Vars.ui;
|
|||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.ucore.scene.Element;
|
||||
import io.anuke.ucore.scene.builders.build;
|
||||
import io.anuke.ucore.scene.builders.imagebutton;
|
||||
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
||||
import io.anuke.ucore.scene.ui.ImageButton;
|
||||
import io.anuke.ucore.scene.ui.layout.Cell;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
|
||||
|
|
@ -69,6 +71,8 @@ public class MenuDialog extends FloatingDialog{
|
|||
}else{
|
||||
build.begin(content());
|
||||
|
||||
PressGroup group = new PressGroup();
|
||||
|
||||
content().defaults().size(120f).pad(5).units(Unit.dp);
|
||||
float isize = Unit.dp.inPixels(14f*4);
|
||||
|
||||
|
|
@ -94,6 +98,12 @@ public class MenuDialog extends FloatingDialog{
|
|||
}}.show();
|
||||
}).text("Quit").padTop(4f);
|
||||
|
||||
for(Element e : content().getChildren()){
|
||||
if(e instanceof ImageButton){
|
||||
group.add((ImageButton)e);
|
||||
}
|
||||
}
|
||||
|
||||
build.end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
core/src/io/anuke/mindustry/ui/PressGroup.java
Normal file
16
core/src/io/anuke/mindustry/ui/PressGroup.java
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package io.anuke.mindustry.ui;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.ucore.scene.ui.Button;
|
||||
|
||||
public class PressGroup{
|
||||
private Array<Button> buttons = new Array<>();
|
||||
private boolean active = true;
|
||||
|
||||
public void add(Button button){
|
||||
//TODO make only one button in the group be clickable
|
||||
buttons.add(button);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import io.anuke.mindustry.Mindustry;
|
|||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.ui.MenuButton;
|
||||
import io.anuke.mindustry.ui.PressGroup;
|
||||
import io.anuke.mindustry.world.Map;
|
||||
import io.anuke.ucore.scene.builders.imagebutton;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
|
|
@ -21,25 +22,27 @@ public class MenuFragment implements Fragment{
|
|||
new table(){{
|
||||
|
||||
new table(){{
|
||||
PressGroup group = new PressGroup();
|
||||
|
||||
float scale = 4f;
|
||||
defaults().size(100*scale, 21*scale).pad(-10f).units(Unit.dp);
|
||||
|
||||
add(new MenuButton("text-play", ()-> ui.showLevels()));
|
||||
add(new MenuButton("text-play", group, ()-> ui.showLevels()));
|
||||
row();
|
||||
|
||||
add(new MenuButton("text-tutorial", ()-> control.playMap(Map.tutorial)));
|
||||
add(new MenuButton("text-tutorial", group, ()-> control.playMap(Map.tutorial)));
|
||||
row();
|
||||
|
||||
if(!gwt){
|
||||
add(new MenuButton("text-load", ()-> ui.showLoadGame()));
|
||||
add(new MenuButton("text-load", group, ()-> ui.showLoadGame()));
|
||||
row();
|
||||
}
|
||||
|
||||
add(new MenuButton("text-settings", ()-> ui.showPrefs()));
|
||||
add(new MenuButton("text-settings", group, ()-> ui.showPrefs()));
|
||||
row();
|
||||
|
||||
if(!gwt){
|
||||
add(new MenuButton("text-exit", ()-> Gdx.app.exit()));
|
||||
add(new MenuButton("text-exit", group, ()-> Gdx.app.exit()));
|
||||
}
|
||||
get().pad(Unit.dp.inPixels(16));
|
||||
}}.end();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class ProductionBlocks{
|
|||
|
||||
@Override
|
||||
public int handleDamage(Tile tile, int amount){
|
||||
return Vars.debug ? amount : amount;
|
||||
return Vars.debug ? 0 : amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue