Made core 3x3
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 552 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
@@ -166,7 +166,7 @@ public class Control extends Module{
|
|||||||
Vars.renderer.clearTiles();
|
Vars.renderer.clearTiles();
|
||||||
|
|
||||||
player.x = World.core.worldx();
|
player.x = World.core.worldx();
|
||||||
player.y = World.core.worldy() - 8f - ((int)(Gdx.graphics.getWidth() / (float)Core.cameraScale * 2) % 2 == 0 ? 0.5f : 0);
|
player.y = World.core.worldy() - Vars.tilesize*2 - ((int)(Gdx.graphics.getWidth() / (float)Core.cameraScale * 2) % 2 == 0 ? 0.5f : 0);
|
||||||
|
|
||||||
Core.camera.position.set(player.x, player.y, 0);
|
Core.camera.position.set(player.x, player.y, 0);
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ public class Control extends Module{
|
|||||||
respawntime -= delta();
|
respawntime -= delta();
|
||||||
|
|
||||||
if(respawntime <= 0){
|
if(respawntime <= 0){
|
||||||
player.set(World.core.worldx(), World.core.worldy()-8);
|
player.set(World.core.worldx(), World.core.worldy()-Vars.tilesize*2);
|
||||||
player.heal();
|
player.heal();
|
||||||
player.add();
|
player.add();
|
||||||
Effects.sound("respawn");
|
Effects.sound("respawn");
|
||||||
|
|||||||
@@ -342,8 +342,11 @@ public class Renderer extends RendererModule{
|
|||||||
//block breaking
|
//block breaking
|
||||||
if(Inputs.buttonDown(Buttons.RIGHT) && World.validBreak(Input.tilex(), Input.tiley())){
|
if(Inputs.buttonDown(Buttons.RIGHT) && World.validBreak(Input.tilex(), Input.tiley())){
|
||||||
Tile tile = World.tile(Input.tilex(), Input.tiley());
|
Tile tile = World.tile(Input.tilex(), Input.tiley());
|
||||||
|
if(tile.isLinked()) tile = tile.getLinked();
|
||||||
|
Vector2 offset = tile.block().getPlaceOffset();
|
||||||
|
|
||||||
Draw.color(Color.YELLOW, Color.SCARLET, player.breaktime / tile.getBreakTime());
|
Draw.color(Color.YELLOW, Color.SCARLET, player.breaktime / tile.getBreakTime());
|
||||||
Draw.square(tile.worldx(), tile.worldy(), 4);
|
Draw.linecrect(tile.worldx() + offset.x, tile.worldy() + offset.y, tile.block().width * Vars.tilesize, tile.block().height * Vars.tilesize);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}else if(android && player.breaktime > 0){ //android block breaking
|
}else if(android && player.breaktime > 0){ //android block breaking
|
||||||
Vector2 vec = Graphics.world(Gdx.input.getX(0), Gdx.input.getY(0));
|
Vector2 vec = Graphics.world(Gdx.input.getX(0), Gdx.input.getY(0));
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.badlogic.gdx.Input.Keys;
|
|||||||
import com.badlogic.gdx.InputAdapter;
|
import com.badlogic.gdx.InputAdapter;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.Vars;
|
||||||
|
import io.anuke.mindustry.resource.ItemStack;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.World;
|
import io.anuke.mindustry.world.World;
|
||||||
import io.anuke.ucore.core.Graphics;
|
import io.anuke.ucore.core.Graphics;
|
||||||
@@ -72,7 +74,11 @@ public class AndroidInput extends InputAdapter{
|
|||||||
if(player.recipe != null &&
|
if(player.recipe != null &&
|
||||||
World.validPlace(tilex, tiley, player.recipe.result)){
|
World.validPlace(tilex, tiley, player.recipe.result)){
|
||||||
|
|
||||||
World.placeBlock(tilex, tiley);
|
World.placeBlock(tilex, tiley, player.recipe.result, player.rotation);
|
||||||
|
|
||||||
|
for(ItemStack stack : player.recipe.requirements){
|
||||||
|
Vars.control.removeItem(stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.Input.Keys;
|
|||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
|
import io.anuke.mindustry.resource.ItemStack;
|
||||||
import io.anuke.mindustry.resource.Weapon;
|
import io.anuke.mindustry.resource.Weapon;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.World;
|
import io.anuke.mindustry.world.World;
|
||||||
@@ -48,7 +49,15 @@ public class Input{
|
|||||||
World.validPlace(tilex(), tiley(), player.recipe.result) && !ui.hasMouse() && cursorNear() &&
|
World.validPlace(tilex(), tiley(), player.recipe.result) && !ui.hasMouse() && cursorNear() &&
|
||||||
Vars.control.hasItems(player.recipe.requirements)){
|
Vars.control.hasItems(player.recipe.requirements)){
|
||||||
|
|
||||||
World.placeBlock(tilex(), tiley());
|
World.placeBlock(tilex(), tiley(), player.recipe.result, player.rotation);
|
||||||
|
|
||||||
|
for(ItemStack stack : player.recipe.requirements){
|
||||||
|
Vars.control.removeItem(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!Vars.control.hasItems(player.recipe.requirements)){
|
||||||
|
Cursors.restoreCursor();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class Tile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean passable(){
|
public boolean passable(){
|
||||||
return !(floor.solid || (block.solid && !block.update));
|
return isLinked() || !(floor.solid || (block.solid && !block.update));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean solid(){
|
public boolean solid(){
|
||||||
|
|||||||
@@ -11,14 +11,12 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.ai.Pathfind;
|
import io.anuke.mindustry.ai.Pathfind;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.resource.ItemStack;
|
|
||||||
import io.anuke.mindustry.world.blocks.*;
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Sounds;
|
import io.anuke.ucore.core.Sounds;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
import io.anuke.ucore.entities.Entity;
|
import io.anuke.ucore.entities.Entity;
|
||||||
import io.anuke.ucore.entities.SolidEntity;
|
import io.anuke.ucore.entities.SolidEntity;
|
||||||
import io.anuke.ucore.scene.utils.Cursors;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Tmp;
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
@@ -149,7 +147,8 @@ public class World{
|
|||||||
|
|
||||||
Pathfind.reset();
|
Pathfind.reset();
|
||||||
|
|
||||||
core.setBlock(ProductionBlocks.core);
|
//TODO multiblock core
|
||||||
|
placeBlock(core.x, core.y, ProductionBlocks.core, 0);
|
||||||
|
|
||||||
if(map != Map.tutorial){
|
if(map != Map.tutorial){
|
||||||
setDefaultBlocks();
|
setDefaultBlocks();
|
||||||
@@ -163,7 +162,7 @@ public class World{
|
|||||||
static void setDefaultBlocks(){
|
static void setDefaultBlocks(){
|
||||||
int x = core.x, y = core.y;
|
int x = core.x, y = core.y;
|
||||||
|
|
||||||
set(x, y-1, DistributionBlocks.conveyor, 1);
|
//set(x, y-1, DistributionBlocks.conveyor, 1);
|
||||||
set(x, y-2, DistributionBlocks.conveyor, 1);
|
set(x, y-2, DistributionBlocks.conveyor, 1);
|
||||||
set(x, y-3, DistributionBlocks.conveyor, 1);
|
set(x, y-3, DistributionBlocks.conveyor, 1);
|
||||||
|
|
||||||
@@ -200,17 +199,15 @@ public class World{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO move to control or player?
|
//TODO move to control or player?
|
||||||
public static void placeBlock(int x, int y){
|
public static void placeBlock(int x, int y, Block result, int rotation){
|
||||||
Tile tile = tile(x, y);
|
Tile tile = tile(x, y);
|
||||||
|
|
||||||
//just in case
|
//just in case
|
||||||
if(tile == null)
|
if(tile == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block result = player.recipe.result;
|
|
||||||
|
|
||||||
tile.setBlock(result);
|
tile.setBlock(result);
|
||||||
tile.rotation = (byte)player.rotation;
|
tile.rotation = (byte)rotation;
|
||||||
|
|
||||||
if(result.isMultiblock()){
|
if(result.isMultiblock()){
|
||||||
int offsetx = -(result.width-1)/2;
|
int offsetx = -(result.width-1)/2;
|
||||||
@@ -221,7 +218,6 @@ public class World{
|
|||||||
int worldx = dx + offsetx + x;
|
int worldx = dx + offsetx + x;
|
||||||
int worldy = dy + offsety + y;
|
int worldy = dy + offsety + y;
|
||||||
if(!(worldx == x && worldy == y)){
|
if(!(worldx == x && worldy == y)){
|
||||||
//TODO make sure this is correct
|
|
||||||
Tile toplace = tile(worldx, worldy);
|
Tile toplace = tile(worldx, worldy);
|
||||||
toplace.setLinked((byte)(dx + offsetx), (byte)(dy + offsety));
|
toplace.setLinked((byte)(dx + offsetx), (byte)(dy + offsety));
|
||||||
}
|
}
|
||||||
@@ -235,14 +231,6 @@ public class World{
|
|||||||
|
|
||||||
Effects.shake(2f, 2f, player);
|
Effects.shake(2f, 2f, player);
|
||||||
Sounds.play("place");
|
Sounds.play("place");
|
||||||
|
|
||||||
for(ItemStack stack : player.recipe.requirements){
|
|
||||||
Vars.control.removeItem(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Vars.control.hasItems(player.recipe.requirements)){
|
|
||||||
Cursors.restoreCursor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO move this to control?
|
//TODO move this to control?
|
||||||
@@ -337,6 +325,10 @@ public class World{
|
|||||||
|
|
||||||
if(tile == null || tile.block() == ProductionBlocks.core) return false;
|
if(tile == null || tile.block() == ProductionBlocks.core) return false;
|
||||||
|
|
||||||
|
if(tile.isLinked() && tile.getLinked().block() == ProductionBlocks.core){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(Vars.control.getTutorial().active()){
|
if(Vars.control.getTutorial().active()){
|
||||||
|
|
||||||
if(Vars.control.getTutorial().showBlock()){
|
if(Vars.control.getTutorial().showBlock()){
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ public class ProductionBlocks{
|
|||||||
|
|
||||||
core = new Block("core"){
|
core = new Block("core"){
|
||||||
{
|
{
|
||||||
health = 300;
|
health = 600;
|
||||||
solid = true;
|
solid = true;
|
||||||
update = true;
|
update = true;
|
||||||
|
width = 3;
|
||||||
|
height = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user