Search in sources :

Example 16 with Enemy

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;
    }
}
Also used : Enemy(io.anuke.mindustry.entities.enemies.Enemy)

Example 17 with Enemy

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();
}
Also used : Enemy(io.anuke.mindustry.entities.enemies.Enemy)

Example 18 with Enemy

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));
    }
}
Also used : Enemy(io.anuke.mindustry.entities.enemies.Enemy)

Example 19 with Enemy

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();
}
Also used : Enemy(io.anuke.mindustry.entities.enemies.Enemy)

Example 20 with Enemy

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;
}
Also used : BlockPair(io.anuke.mindustry.world.ColorMapper.BlockPair) Enemy(io.anuke.mindustry.entities.enemies.Enemy) SpawnPoint(io.anuke.mindustry.game.SpawnPoint) SpawnPoint(io.anuke.mindustry.game.SpawnPoint)

Aggregations

Enemy (io.anuke.mindustry.entities.enemies.Enemy)20 Tile (io.anuke.mindustry.world.Tile)10 Block (io.anuke.mindustry.world.Block)5 Array (com.badlogic.gdx.utils.Array)4 SpawnPoint (io.anuke.mindustry.game.SpawnPoint)4 Item (io.anuke.mindustry.resource.Item)4 IOException (java.io.IOException)4 BlockPart (io.anuke.mindustry.world.blocks.types.BlockPart)3 Rock (io.anuke.mindustry.world.blocks.types.Rock)3 IntMap (com.badlogic.gdx.utils.IntMap)2 FileHandle (com.badlogic.gdx.files.FileHandle)1 Interpolation (com.badlogic.gdx.math.Interpolation)1 Vector2 (com.badlogic.gdx.math.Vector2)1 Player (io.anuke.mindustry.entities.Player)1 EnemySpawn (io.anuke.mindustry.game.EnemySpawn)1 InputHandler (io.anuke.mindustry.input.InputHandler)1 ToolFragment (io.anuke.mindustry.ui.fragments.ToolFragment)1 BlockBar (io.anuke.mindustry.world.BlockBar)1 BlockPair (io.anuke.mindustry.world.ColorMapper.BlockPair)1 ShieldBlock (io.anuke.mindustry.world.blocks.types.defense.ShieldBlock)1