Scale waves based on difficulty; improve map editor

This commit is contained in:
Anuken
2017-12-18 17:37:14 -05:00
parent 1ae875ebf4
commit 7953a21073
34 changed files with 857 additions and 714 deletions

View File

@@ -78,7 +78,7 @@ public class AndroidInput extends InputHandler{
if(!GameState.is(State.menu)){
Tile cursor = world.tile(Mathf.scl2(Graphics.mouseWorld().x, tilesize), Mathf.scl2(Graphics.mouseWorld().y, tilesize));
if(cursor != null && !ui.hasMouse()){
if(cursor != null && !ui.hasMouse(screenX, screenY)){
Tile linked = cursor.isLinked() ? cursor.getLinked() : cursor;
if(linked != null && linked.block() instanceof Configurable){
ui.showConfig(linked);
@@ -155,7 +155,7 @@ public class AndroidInput extends InputHandler{
}
@Override
public void tryPlaceBlock(int x, int y, boolean sound){
public boolean tryPlaceBlock(int x, int y, boolean sound){
if(player.recipe != null &&
validPlace(x, y, player.recipe.result) && cursorNear() &&
Vars.control.hasItems(player.recipe.requirements)){
@@ -169,6 +169,8 @@ public class AndroidInput extends InputHandler{
if(!Vars.control.hasItems(player.recipe.requirements)){
Cursors.restoreCursor();
}
return true;
}
return false;
}
}

View File

@@ -94,7 +94,7 @@ public class DesktopInput extends InputHandler{
Tile cursor = world.tile(tilex(), tiley());
if(Inputs.buttonUp(Buttons.LEFT) && cursor != null){
if(Inputs.buttonUp(Buttons.LEFT) && cursor != null && !ui.hasMouse()){
Tile linked = cursor.isLinked() ? cursor.getLinked() : cursor;
if(linked != null && linked.block() instanceof Configurable){
ui.showConfig(linked);

View File

@@ -49,7 +49,7 @@ public abstract class InputHandler extends InputAdapter{
return Vector2.dst(player.x, player.y, getBlockX() * tilesize, getBlockY() * tilesize) <= placerange;
}
public void tryPlaceBlock(int x, int y, boolean sound){
public boolean tryPlaceBlock(int x, int y, boolean sound){
if(player.recipe != null &&
validPlace(x, y, player.recipe.result) && !ui.hasMouse() && cursorNear() &&
Vars.control.hasItems(player.recipe.requirements)){
@@ -63,7 +63,9 @@ public abstract class InputHandler extends InputAdapter{
if(!Vars.control.hasItems(player.recipe.requirements)){
Cursors.restoreCursor();
}
return true;
}
return false;
}
public boolean tryDeleteBlock(int x, int y, boolean sound){

View File

@@ -306,10 +306,12 @@ public enum PlaceMode{
boolean first = true;
for(int x = 0; x <= Math.abs(this.endx - this.tilex); x ++){
for(int y = 0; y <= Math.abs(this.endy - this.tiley); y ++){
control.getInput().tryPlaceBlock(
if(control.getInput().tryPlaceBlock(
tilex + x * Mathf.sign(endx - tilex),
tiley + y * Mathf.sign(endy - tiley), first);
first = false;
tiley + y * Mathf.sign(endy - tiley), first)){
first = false;
}
}
}
}