More bugfixes

This commit is contained in:
Anuken 2017-12-06 09:26:39 -05:00
parent aafe7fb74a
commit 8e80af26d7
6 changed files with 61 additions and 55 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.anuke.mindustry"
android:versionCode="16"
android:versionName="3.0b" >
android:versionCode="18"
android:versionName="3.02b" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />

View File

@ -79,7 +79,7 @@ project(":core") {
apply plugin: "java"
dependencies {
compile 'com.github.Anuken:ucore:92dc170f0e'
compile 'com.github.Anuken:ucore:a64bf7e'
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
}

View File

@ -3,17 +3,17 @@ package io.anuke.mindustry.input;
import static io.anuke.mindustry.Vars.*;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Buttons;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.Configurable;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Inputs;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.scene.ui.layout.Unit;
import io.anuke.ucore.util.Mathf;
@ -27,7 +27,7 @@ public class AndroidInput extends InputAdapter{
private static float warmupDelay = 20;
@Override
public boolean keyDown (int keycode) {
public boolean keyDown(int keycode){
if(keycode == Keys.E){
place();
}
@ -35,19 +35,31 @@ public class AndroidInput extends InputAdapter{
}
@Override
public boolean touchUp (int screenX, int screenY, int pointer, int button) {
public boolean touchUp(int screenX, int screenY, int pointer, int button){
brokeBlock = false;
return false;
}
@Override
public boolean touchDown (int screenX, int screenY, int pointer, int button) {
public boolean touchDown(int screenX, int screenY, int pointer, int button){
ui.hideTooltip();
if(pointer == 0){
lmousex = screenX;
lmousey = screenY;
}
warmup = 0;
if(!GameState.is(State.menu)){
Tile cursor = Vars.world.tile(Mathf.scl2(Graphics.mouseWorld().x, tilesize), Mathf.scl2(Graphics.mouseWorld().y, tilesize));
if(cursor != null && !Vars.ui.hasMouse()){
Tile linked = cursor.isLinked() ? cursor.getLinked() : cursor;
if(linked != null && linked.block() instanceof Configurable){
Vars.ui.showConfig(linked);
}else if(!Vars.ui.hasConfigMouse()){
Vars.ui.hideConfig();
}
}
}
return false;
}
@ -73,8 +85,7 @@ public class AndroidInput extends InputAdapter{
int tilex = Mathf.scl2(vec.x, tilesize);
int tiley = Mathf.scl2(vec.y, tilesize);
if(player.recipe != null &&
Vars.world.validPlace(tilex, tiley, player.recipe.result)){
if(player.recipe != null && Vars.world.validPlace(tilex, tiley, player.recipe.result)){
Vars.world.placeBlock(tilex, tiley, player.recipe.result, player.rotation);
@ -85,21 +96,12 @@ public class AndroidInput extends InputAdapter{
}
public static void doInput(){
Tile cursor = selected();
//TODO test
if(Inputs.buttonUp(Buttons.LEFT) && cursor != null){
Tile linked = cursor.isLinked() ? cursor.getLinked() : cursor;
if(linked != null && linked.block() instanceof Configurable){
Vars.ui.showConfig(linked);
}else if(!Vars.ui.hasConfigMouse()){
Vars.ui.hideConfig();
}
}
if(Gdx.input.isTouched(0)
&& Mathf.near2d(lmousex, lmousey, Gdx.input.getX(0), Gdx.input.getY(0), Unit.dp.inPixels(50))
&& !ui.hasMouse() /*&& (player.recipe == null || mode == PlaceMode.touch)*/){
if(Gdx.input.isTouched(0) && Mathf.near2d(lmousex, lmousey, Gdx.input.getX(0), Gdx.input.getY(0), Unit.dp.inPixels(50))
&& !ui.hasMouse() /*
* && (player.recipe == null || mode ==
* PlaceMode.touch)
*/){
warmup += Timers.delta();
float lx = mousex, ly = mousey;
@ -109,7 +111,8 @@ public class AndroidInput extends InputAdapter{
Tile sel = selected();
if(sel == null) return;
if(sel == null)
return;
if(warmup > warmupDelay && Vars.world.validBreak(sel.x, sel.y)){
player.breaktime += Timers.delta();
@ -135,9 +138,9 @@ public class AndroidInput extends InputAdapter{
public static int touches(){
int sum = 0;
for(int i = 0; i < 10; i ++){
for(int i = 0; i < 10; i++){
if(Gdx.input.isTouched(i))
sum ++;
sum++;
}
return sum;
}

View File

@ -175,10 +175,11 @@ public class HudFragment implements Fragment{
new label(()-> control.getEnemiesRemaining() > 0 ?
control.getEnemiesRemaining() + " enemies" :
(control.getTutorial().active() || Vars.control.getMode() == GameMode.sandbox) ? "waiting..." : "Wave in " + (int) (control.getWaveCountdown() / 60f))
.minWidth(140).left();
.minWidth(140).units(Unit.dp).left();
get().pad(Unit.dp.inPixels(12));
}}.left().padLeft(-6).end();
get().padLeft(6);
}}.left().end();
playButton(uheight);
//get().padTop(Unit.dp.inPixels(1));
@ -190,7 +191,8 @@ public class HudFragment implements Fragment{
private void playButton(float uheight){
new imagebutton("icon-play", Unit.dp.inPixels(30f), ()->{
Vars.control.runWave();
}).height(uheight).fillX().padTop(-8f).padBottom(-12f).padRight(-18f).padLeft(-10f).width(40f).units(Unit.dp).update(l->{
}).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padRight(-36)
.padLeft(-10f).width(40f).units(Unit.dp).update(l->{
boolean vis = Vars.control.getMode() == GameMode.sandbox && Vars.control.getEnemiesRemaining() <= 0;
boolean paused = GameState.is(State.paused) || !vis;

View File

@ -17,13 +17,14 @@ import io.anuke.ucore.util.Strings;
public class ShieldBlock extends PowerBlock{
public float shieldRadius = 40f;
public float powerDrain = 0.005f;
public float powerPerDamage = 0.1f;
public float powerPerDamage = 0.2f;
public float maxRadius = 40f;
public float radiusPowerScale = 7.5f;
public float radiusScale = 80f;
public ShieldBlock(String name) {
super(name);
voltage = powerDrain;
powerCapacity = 30f;
health = 100;
}
@ -57,7 +58,7 @@ public class ShieldBlock extends PowerBlock{
}
}
entity.shield.radius = Mathf.lerp(entity.shield.radius, Math.min(entity.power * radiusPowerScale, maxRadius), Timers.delta() * 0.05f);
entity.shield.radius = Mathf.lerp(entity.shield.radius, Math.min(entity.power / powerCapacity * radiusScale, maxRadius), Timers.delta() * 0.05f);
}

Binary file not shown.