use of io.anuke.mindustry.entities.enemies.Enemy in project Mindustry by Anuken.
the class HealerType method updateShooting.
@Override
public void updateShooting(Enemy enemy) {
Enemy target = (Enemy) enemy.target;
if (target.health < target.maxhealth && enemy.timer.get(timerReload, reload)) {
target.health++;
enemy.idletime = 0;
}
}
use of io.anuke.mindustry.entities.enemies.Enemy in project Mindustry by Anuken.
the class HealerType method drawOver.
@Override
public void drawOver(Enemy enemy) {
Enemy target = (Enemy) enemy.target;
if (target == null)
return;
enemy.tr.trns(enemy.angleTo(target), 5f);
Shaders.outline.color.set(Color.CLEAR);
Shaders.outline.apply();
if (target.health < target.maxhealth) {
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time()) + 1f) / 13f));
Draw.alpha(0.9f);
Shapes.laser("laser", "laserend", enemy.x + enemy.tr.x, enemy.y + enemy.tr.y, target.x - enemy.tr.x / 1.5f, target.y - enemy.tr.y / 1.5f);
Draw.color();
}
Graphics.flush();
}
use of io.anuke.mindustry.entities.enemies.Enemy in project Mindustry by Anuken.
the class LaserTurret method shoot.
@Override
public void shoot(Tile tile) {
TurretEntity entity = tile.entity();
Enemy enemy = entity.target;
if (Angles.angleDist(entity.rotation, Angles.angle(tile.drawx(), tile.drawy(), enemy.x, enemy.y)) < cone) {
enemy.damage(damage);
Effects.effect(hiteffect, enemy.x + Mathf.range(3), enemy.y + Mathf.range(3));
}
}
use of io.anuke.mindustry.entities.enemies.Enemy in project Mindustry by Anuken.
the class LaserTurret method drawLayer2.
@Override
public void drawLayer2(Tile tile) {
TurretEntity entity = tile.entity();
Enemy enemy = entity.target;
if (enemy != null && Angles.angleDist(entity.rotation, Angles.angle(tile.drawx(), tile.drawy(), enemy.x, enemy.y)) <= cone) {
float len = 4f;
float x = tile.drawx() + Angles.trnsx(entity.rotation, len), y = tile.drawy() + Angles.trnsy(entity.rotation, len);
float x2 = enemy.x, y2 = enemy.y;
float lighten = (MathUtils.sin(Timers.time() / 1.2f) + 1f) / 10f;
Draw.color(Tmp.c1.set(beamColor).mul(1f + lighten, 1f + lighten, 1f + lighten, 1f));
Draw.alpha(0.3f);
Lines.stroke(4f);
Lines.line(x, y, x2, y2);
Lines.stroke(2f);
Draw.rect("circle", x2, y2, 7f, 7f);
Draw.alpha(1f);
Lines.stroke(2f);
Lines.line(x, y, x2, y2);
Lines.stroke(1f);
Draw.rect("circle", x2, y2, 5f, 5f);
}
Draw.reset();
}
use of io.anuke.mindustry.entities.enemies.Enemy in project Mindustry by Anuken.
the class WorldGenerator method generate.
/**
*Returns the core (starting) block. Should fill spawns with the correct spawnpoints.
*/
public static Tile generate(Pixmap pixmap, Tile[][] tiles, Array<SpawnPoint> spawns) {
Noise.setSeed(world.getSeed());
Tile core = null;
for (int x = 0; x < pixmap.getWidth(); x++) {
for (int y = 0; y < pixmap.getHeight(); y++) {
Block floor = Blocks.stone;
Block block = Blocks.air;
int color = pixmap.getPixel(x, pixmap.getHeight() - 1 - y);
BlockPair pair = ColorMapper.get(color);
if (pair != null) {
block = pair.wall;
floor = pair.floor;
}
if (block == SpecialBlocks.playerSpawn) {
block = Blocks.air;
core = world.tile(x, y);
} else if (block == SpecialBlocks.enemySpawn) {
block = Blocks.air;
spawns.add(new SpawnPoint(tiles[x][y]));
}
if (block == Blocks.air && Mathf.chance(0.025) && rocks.containsKey(floor)) {
block = rocks.get(floor);
}
if (world.getMap().oreGen && (floor == Blocks.stone || floor == Blocks.grass || floor == Blocks.blackstone || floor == Blocks.snow || floor == Blocks.sand)) {
if (Noise.nnoise(x, y, 8, 1) > 0.21) {
floor = Blocks.iron;
}
if (Noise.nnoise(x, y, 6, 1) > 0.237) {
floor = Blocks.coal;
}
if (Noise.nnoise(x + 9999, y + 9999, 8, 1) > 0.27) {
floor = Blocks.titanium;
}
if (Noise.nnoise(x + 99999, y + 99999, 7, 1) > 0.259) {
floor = Blocks.uranium;
}
}
if (color == Hue.rgb(Color.PURPLE)) {
if (!Vars.android)
new Enemy(EnemyTypes.target).set(x * tilesize, y * tilesize).add();
floor = Blocks.stone;
}
tiles[x][y].setBlock(block, 0);
tiles[x][y].setFloor(floor);
}
}
for (int x = 0; x < pixmap.getWidth(); x++) {
for (int y = 0; y < pixmap.getHeight(); y++) {
tiles[x][y].updateOcclusion();
}
}
return core;
}
Aggregations