Re-implement E/R controls, add toggle UI button for debugging

This commit is contained in:
Anuken
2017-12-12 14:28:51 -05:00
parent c7c7021699
commit de6ccbbc88
11 changed files with 42 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry;
import com.badlogic.gdx.Application.ApplicationType; import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.I18NBundle;
import io.anuke.mindustry.core.Control; import io.anuke.mindustry.core.Control;
import io.anuke.mindustry.core.Renderer; import io.anuke.mindustry.core.Renderer;
@@ -50,8 +51,10 @@ public class Vars{
public static boolean showPaths = false; public static boolean showPaths = false;
//if false, player is always hidden //if false, player is always hidden
public static boolean showPlayer = true; public static boolean showPlayer = true;
//whether to hide ui, only on debug
public static boolean showUI = true;
//number of save slots-- increasing may lead to layout issues //number of save slots-- increasing may lead to layout issues
//TODO named save slots, possibly with a scroll dialog //TODO named save slots
public static final int saveSlots = 8; public static final int saveSlots = 8;
//amount of drops that are left when breaking a block //amount of drops that are left when breaking a block
public static final float breakDropAmount = 0.5f; public static final float breakDropAmount = 0.5f;
@@ -64,6 +67,8 @@ public class Vars{
public static final int tilesize = 8; public static final int tilesize = 8;
public static I18NBundle bundle;
public static Control control; public static Control control;
public static Renderer renderer; public static Renderer renderer;
public static UI ui; public static UI ui;

View File

@@ -106,7 +106,9 @@ public class Control extends Module{
"zoom_hold", Keys.CONTROL_LEFT, "zoom_hold", Keys.CONTROL_LEFT,
"menu", Gdx.app.getType() == ApplicationType.Android ? Keys.BACK : Keys.ESCAPE, "menu", Gdx.app.getType() == ApplicationType.Android ? Keys.BACK : Keys.ESCAPE,
"pause", Keys.SPACE, "pause", Keys.SPACE,
"dash", Keys.SHIFT_LEFT "dash", Keys.SHIFT_LEFT,
"rotate_right", Keys.R,
"rotate_left", Keys.E
); );
for(int i = 0; i < Vars.saveSlots; i ++){ for(int i = 0; i < Vars.saveSlots; i ++){
@@ -419,6 +421,10 @@ public class Control extends Module{
wavetime = 0f; wavetime = 0f;
} }
if(Inputs.keyUp(Keys.U)){
Vars.showUI = !Vars.showUI;
}
if(Inputs.keyUp(Keys.O)){ if(Inputs.keyUp(Keys.O)){
Vars.noclip = !Vars.noclip; Vars.noclip = !Vars.noclip;
} }

View File

@@ -191,7 +191,7 @@ public class Renderer extends RendererModule{
drawOverlay(); drawOverlay();
if(Settings.getBool("indicators")){ if(Settings.getBool("indicators") && Vars.showUI){
drawEnemyMarkers(); drawEnemyMarkers();
} }
} }
@@ -562,13 +562,16 @@ public class Renderer extends RendererModule{
} }
} }
//draw entity health bars if(!Vars.debug || Vars.showUI){
for(Enemy entity : control.enemyGroup.all()){
drawHealth(entity);
}
if(!Vars.android && Vars.showPlayer) //draw entity health bars
drawHealth(player); for(Enemy entity : control.enemyGroup.all()){
drawHealth(entity);
}
if(!Vars.android && Vars.showPlayer)
drawHealth(player);
}
} }
void drawHealth(DestructibleEntity dest){ void drawHealth(DestructibleEntity dest){

View File

@@ -131,6 +131,8 @@ public class UI extends SceneModule{
@Override @Override
public void update(){ public void update(){
if(Vars.debug && !Vars.showUI) return;
Profiler.begin("ui"); Profiler.begin("ui");
if(nplay.visible()){ if(nplay.visible()){

View File

@@ -56,7 +56,7 @@ public class Player extends DestructibleEntity{
@Override @Override
public void draw(){ public void draw(){
if(!Vars.showPlayer) return; if(Vars.debug && (!Vars.showPlayer || !Vars.showUI)) return;
if(Vars.snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate")){ if(Vars.snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate")){
Draw.rect("mech-"+mech.name(), (int)x, (int)y, direction.angle()-90); Draw.rect("mech-"+mech.name(), (int)x, (int)y, direction.angle()-90);

View File

@@ -98,7 +98,7 @@ public class WaveCreator{
new EnemySpawn(TitanEnemy.class){{ new EnemySpawn(TitanEnemy.class){{
after = 16; after = 16;
amount = 2; amount = 1;
spacing = 5; spacing = 5;
scaling = 3; scaling = 3;
tierscaleback = 0; tierscaleback = 0;

View File

@@ -219,9 +219,11 @@ public class Enemy extends DestructibleEntity{
@Override @Override
public void removed(){ public void removed(){
if(!dead){ if(!dead){
Vars.control.enemyDeath();
if(spawner != null){ if(spawner != null){
spawner.spawned --; spawner.spawned --;
}else{
Vars.control.enemyDeath();
} }
} }
} }

View File

@@ -10,14 +10,14 @@ import io.anuke.ucore.util.Angles;
public class FortressEnemy extends Enemy{ public class FortressEnemy extends Enemy{
static int maxSpawn = 6; static int maxSpawn = 6;
float spawnTime = 240; float spawnTime = 190;
boolean deployed; boolean deployed;
public FortressEnemy() { public FortressEnemy() {
speed = 0.25f; speed = 0.25f;
reload = 90; reload = 90;
maxhealth = 800; maxhealth = 700;
range = 70f; range = 70f;
bullet = BulletType.yellowshell; bullet = BulletType.yellowshell;
hitbox.setSize(10f); hitbox.setSize(10f);
@@ -47,7 +47,7 @@ public class FortressEnemy extends Enemy{
spawned ++; spawned ++;
} }
}else if(distanceTo(Vars.control.getCore().worldx(), }else if(distanceTo(Vars.control.getCore().worldx(),
Vars.control.getCore().worldy()) <= 120f){ Vars.control.getCore().worldy()) <= 90f){
deployed = true; deployed = true;
speed = 0.001f; speed = 0.001f;
} }

View File

@@ -33,6 +33,14 @@ public class Input{
player.rotation += Inputs.scroll(); player.rotation += Inputs.scroll();
} }
if(Inputs.keyUp("rotate_right")){
player.rotation --;
}
if(Inputs.keyUp("rotate_left")){
player.rotation ++;
}
player.rotation = Mathf.mod(player.rotation, 4); player.rotation = Mathf.mod(player.rotation, 4);
for(int i = 0; i < 9; i ++){ for(int i = 0; i < 9; i ++){

View File

@@ -157,7 +157,7 @@ public class BlocksFragment implements Fragment{
header.addImage(region).size(8*5).padTop(4).units(Unit.dp); header.addImage(region).size(8*5).padTop(4).units(Unit.dp);
Label nameLabel = new Label(recipe.result.formalName); Label nameLabel = new Label(recipe.result.formalName);
nameLabel.setWrap(true); nameLabel.setWrap(true);
header.add(nameLabel).padLeft(4).width(135f).units(Unit.dp); header.add(nameLabel).padLeft(2).width(135f).units(Unit.dp);
//extra info //extra info
if(recipe.result.fullDescription != null){ if(recipe.result.fullDescription != null){