Cleaned up UI, merged atlases, added GLProfiling
This commit is contained in:
@@ -9,6 +9,7 @@ import com.badlogic.gdx.utils.ObjectMap;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
@@ -57,7 +58,10 @@ public class TileEntity extends Entity{
|
||||
}
|
||||
|
||||
public void collision(Bullet other){
|
||||
health -= other.getDamage();
|
||||
Block block = tile.block();
|
||||
|
||||
int amount = block.handleDamage(tile, other.getDamage());
|
||||
health -= amount;
|
||||
if(health <= 0) onDeath();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.ShieldBlock;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.entities.BulletEntity;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
|
||||
public class Shield extends Entity{
|
||||
@@ -27,29 +29,39 @@ public class Shield extends Entity{
|
||||
public void update(){
|
||||
if(!(tile.block() instanceof ShieldBlock)){
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
ShieldBlock block = (ShieldBlock)tile.block();
|
||||
|
||||
Entities.getNearby(x, y, block.shieldRadius * 2 + 10, entity->{
|
||||
if(entity instanceof BulletEntity){
|
||||
BulletEntity bullet = (BulletEntity)entity;
|
||||
|
||||
float dst = entity.distanceTo(this);
|
||||
|
||||
if(Math.abs(dst - block.shieldRadius) < 2){
|
||||
bullet.velocity.scl(-1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
if(!(tile.block() instanceof ShieldBlock)){
|
||||
return;
|
||||
}
|
||||
|
||||
ShieldBlock block = (ShieldBlock)tile.block();
|
||||
|
||||
Graphics.surface("shield", false);
|
||||
Draw.color(Color.ROYAL);
|
||||
Draw.thick(2f);
|
||||
Draw.rect("circle2", (int)x + 0.5f, (int)y + 0.5f, 102f, 102f);
|
||||
Draw.rect("circle2", x, y, block.shieldRadius*2, block.shieldRadius*2);
|
||||
Draw.reset();
|
||||
Graphics.surface();
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public void drawOver(){
|
||||
Graphics.surface("shield", false);
|
||||
Draw.thick(1f);
|
||||
Draw.color(Color.SKY);
|
||||
Draw.circle(x, y, ((Timers.time() + 50f) % 100f) / 2f);
|
||||
Draw.circle(x, y, (Timers.time() % 100f) / 2f);
|
||||
Draw.reset();
|
||||
Graphics.surface();
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void added(){
|
||||
|
||||
Reference in New Issue
Block a user