Added sprites for new enemies, various tweaks
@@ -79,7 +79,7 @@ project(":core") {
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.github.anuken:ucore:01b71b6dbd'
|
compile 'com.github.anuken:ucore:2d86b0497e'
|
||||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
|
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
core/assets-raw/sprites/enemies/empenemy-t1.png
Normal file
|
After Width: | Height: | Size: 327 B |
BIN
core/assets-raw/sprites/enemies/empenemy-t2.png
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
core/assets-raw/sprites/enemies/empenemy-t3.png
Normal file
|
After Width: | Height: | Size: 375 B |
BIN
core/assets-raw/sprites/enemies/healerenemy-t1.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
core/assets-raw/sprites/enemies/healerenemy-t2.png
Normal file
|
After Width: | Height: | Size: 303 B |
BIN
core/assets-raw/sprites/enemies/healerenemy-t3.png
Normal file
|
After Width: | Height: | Size: 338 B |
BIN
core/assets-raw/sprites/enemies/titanenemy-t1.png
Normal file
|
After Width: | Height: | Size: 393 B |
BIN
core/assets-raw/sprites/enemies/titanenemy-t2.png
Normal file
|
After Width: | Height: | Size: 383 B |
BIN
core/assets-raw/sprites/enemies/titanenemy-t3.png
Normal file
|
After Width: | Height: | Size: 388 B |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 44 KiB |
@@ -408,7 +408,12 @@ public class Control extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyUp(Keys.Y)){
|
if(Inputs.keyUp(Keys.Y)){
|
||||||
new FastEnemy(0).set(player.x, player.y).add();
|
if(Inputs.keyDown(Keys.SHIFT_LEFT)){
|
||||||
|
new HealerEnemy(0).set(player.x, player.y).add();
|
||||||
|
}else{
|
||||||
|
new TitanEnemy(0).set(player.x, player.y).add();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emp = new BulletType(1.6f, 5){ //TODO implement
|
emp = new BulletType(1.6f, 6){
|
||||||
{
|
{
|
||||||
lifetime = 50f;
|
lifetime = 50f;
|
||||||
hitsize = 6f;
|
hitsize = 6f;
|
||||||
@@ -73,7 +73,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
|
|
||||||
public void removed(Bullet b){
|
public void removed(Bullet b){
|
||||||
Timers.run(5f, ()->{
|
Timers.run(5f, ()->{
|
||||||
new EMP(b.x, b.y).add();
|
new EMP(b.x, b.y, b.damage).add();
|
||||||
});
|
});
|
||||||
Effects.effect("empshockwave", b);
|
Effects.effect("empshockwave", b);
|
||||||
Effects.shake(3f, 3f, b);
|
Effects.shake(3f, 3f, b);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class Player extends DestructibleEntity{
|
|||||||
if(Vars.debug && Inputs.keyDown(Keys.SHIFT_LEFT))
|
if(Vars.debug && Inputs.keyDown(Keys.SHIFT_LEFT))
|
||||||
speed *= 3f;
|
speed *= 3f;
|
||||||
|
|
||||||
if(health < maxhealth && Timers.get(this, 50))
|
if(health < maxhealth && Timers.get(this, "regen", 50))
|
||||||
health ++;
|
health ++;
|
||||||
|
|
||||||
vector.set(0, 0);
|
vector.set(0, 0);
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ public class EMP extends TimedEntity{
|
|||||||
int damage = 6;
|
int damage = 6;
|
||||||
Array<Tile> targets = new Array<>(maxTargets);
|
Array<Tile> targets = new Array<>(maxTargets);
|
||||||
|
|
||||||
public EMP(float x, float y){
|
public EMP(float x, float y, int damage){
|
||||||
|
this.damage = damage;
|
||||||
set(x, y);
|
set(x, y);
|
||||||
|
|
||||||
lifetime = 30f;
|
lifetime = 30f;
|
||||||
@@ -73,12 +74,11 @@ public class EMP extends TimedEntity{
|
|||||||
Draw.rect("circle", target.worldx(), target.worldy(), rad, rad);
|
Draw.rect("circle", target.worldx(), target.worldy(), rad, rad);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 7; i ++){
|
for(int i = 0; i < 14 - targets.size; i ++){
|
||||||
Angles.translation(Mathf.randomSeed(i + id*77)*360f, radius * Vars.tilesize);
|
Angles.translation(Mathf.randomSeed(i + id*77)*360f, radius * Vars.tilesize);
|
||||||
drawLine(x + Angles.x(), y + Angles.y());
|
drawLine(x + Angles.x(), y + Angles.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Draw.thick(fract()*2f);
|
Draw.thick(fract()*2f);
|
||||||
Draw.circle(x, y, radius * Vars.tilesize);
|
Draw.circle(x, y, radius * Vars.tilesize);
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,12 @@ public class EmpEnemy extends Enemy{
|
|||||||
public EmpEnemy(int spawn) {
|
public EmpEnemy(int spawn) {
|
||||||
super(spawn);
|
super(spawn);
|
||||||
|
|
||||||
speed = 0.4f;
|
speed = 0.27f;
|
||||||
reload = 50;
|
reload = 70;
|
||||||
maxhealth = 210;
|
maxhealth = 210;
|
||||||
range = 80f;
|
range = 80f;
|
||||||
bullet = BulletType.emp;
|
bullet = BulletType.emp;
|
||||||
|
turretrotatespeed = 0.1f;
|
||||||
|
|
||||||
heal();
|
heal();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class Enemy extends DestructibleEntity{
|
|||||||
protected float length = 4;
|
protected float length = 4;
|
||||||
protected float rotatespeed = 7f;
|
protected float rotatespeed = 7f;
|
||||||
protected float turretrotatespeed = 0.2f;
|
protected float turretrotatespeed = 0.2f;
|
||||||
|
protected boolean alwaysRotate = false;
|
||||||
protected BulletType bullet = BulletType.small;
|
protected BulletType bullet = BulletType.small;
|
||||||
protected String shootsound = "enemyshoot";
|
protected String shootsound = "enemyshoot";
|
||||||
protected int damage;
|
protected int damage;
|
||||||
@@ -60,7 +61,7 @@ public class Enemy extends DestructibleEntity{
|
|||||||
|
|
||||||
move(vec.x*Timers.delta(), vec.y*Timers.delta());
|
move(vec.x*Timers.delta(), vec.y*Timers.delta());
|
||||||
|
|
||||||
if(Timers.get(this, 15)){
|
if(Timers.get(this, "target", 15)){
|
||||||
target = World.findTileTarget(x, y, null, range, false);
|
target = World.findTileTarget(x, y, null, range, false);
|
||||||
|
|
||||||
//no tile found
|
//no tile found
|
||||||
@@ -131,6 +132,7 @@ public class Enemy extends DestructibleEntity{
|
|||||||
speed += 0.04f*tier + Mathf.range(0.1f);
|
speed += 0.04f*tier + Mathf.range(0.1f);
|
||||||
reload /= Math.max(tier / 1.5f, 1f);
|
reload /= Math.max(tier / 1.5f, 1f);
|
||||||
range += tier*5;
|
range += tier*5;
|
||||||
|
speed = Math.max(speed, 0.07f);
|
||||||
|
|
||||||
heal();
|
heal();
|
||||||
}
|
}
|
||||||
@@ -165,8 +167,8 @@ public class Enemy extends DestructibleEntity{
|
|||||||
xvelocity = (x - lastx) / Timers.delta();
|
xvelocity = (x - lastx) / Timers.delta();
|
||||||
yvelocity = (y - lasty) / Timers.delta();
|
yvelocity = (y - lasty) / Timers.delta();
|
||||||
|
|
||||||
if(target == null){
|
if(target == null || alwaysRotate){
|
||||||
direction.add(xvelocity * Timers.delta(), yvelocity * Timers.delta());
|
direction.add(xvelocity * Timers.delta() / 3f, yvelocity * Timers.delta() / 3f);
|
||||||
direction.limit(speed*rotatespeed);
|
direction.limit(speed*rotatespeed);
|
||||||
}else{
|
}else{
|
||||||
float angle = angleTo(target);
|
float angle = angleTo(target);
|
||||||
|
|||||||
@@ -17,12 +17,13 @@ public class HealerEnemy extends Enemy{
|
|||||||
public HealerEnemy(int spawn) {
|
public HealerEnemy(int spawn) {
|
||||||
super(spawn);
|
super(spawn);
|
||||||
|
|
||||||
speed = 0.4f;
|
speed = 0.2f;
|
||||||
reload = 30;
|
reload = 30;
|
||||||
maxhealth = 210;
|
maxhealth = 210;
|
||||||
range = 80f;
|
range = 90f;
|
||||||
bullet = BulletType.shot;
|
bullet = BulletType.shot;
|
||||||
range = 30f;
|
range = 30f;
|
||||||
|
alwaysRotate = false;
|
||||||
|
|
||||||
heal();
|
heal();
|
||||||
}
|
}
|
||||||
@@ -34,8 +35,8 @@ public class HealerEnemy extends Enemy{
|
|||||||
|
|
||||||
move(vec.x*Timers.delta(), vec.y*Timers.delta());
|
move(vec.x*Timers.delta(), vec.y*Timers.delta());
|
||||||
|
|
||||||
if(Timers.get(this, 15)){
|
if(Timers.get(this, "target", 15)){
|
||||||
target = Entities.getClosest(x, y, range, e->e instanceof Enemy);
|
target = Entities.getClosest(x, y, range, e->e instanceof Enemy && e != this && ((Enemy)e).healthfrac() < 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target != null){
|
if(target != null){
|
||||||
@@ -57,12 +58,14 @@ public class HealerEnemy extends Enemy{
|
|||||||
super.drawOver();
|
super.drawOver();
|
||||||
Enemy enemy = (Enemy)target;
|
Enemy enemy = (Enemy)target;
|
||||||
|
|
||||||
Angles.translation(this.angleTo(enemy), 3f);
|
if(enemy == null) return;
|
||||||
|
|
||||||
|
Angles.translation(this.angleTo(enemy), 5f);
|
||||||
|
|
||||||
if(enemy != null && enemy.health < enemy.maxhealth){
|
if(enemy != null && enemy.health < enemy.maxhealth){
|
||||||
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time()) + 1f) / 14f));
|
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time()) + 1f) / 13f));
|
||||||
Draw.alpha(0.3f);
|
Draw.alpha(0.9f);
|
||||||
Draw.laser("laser", "laserend", x + Angles.x(), y + Angles.y(), enemy.x, enemy.y);
|
Draw.laser("laser", "laserend", x + Angles.x(), y + Angles.y(), enemy.x - Angles.x()/1.5f, enemy.y - Angles.y()/1.5f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,34 +3,46 @@ package io.anuke.mindustry.entities.enemies;
|
|||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.BulletType;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class TitanEnemy extends Enemy{
|
public class TitanEnemy extends Enemy{
|
||||||
|
|
||||||
public TitanEnemy(int spawn) {
|
public TitanEnemy(int spawn) {
|
||||||
super(spawn);
|
super(spawn);
|
||||||
|
|
||||||
speed = 0.4f;
|
speed = 0.1f;
|
||||||
reload = 30;
|
reload = 30;
|
||||||
maxhealth = 210;
|
maxhealth = 210;
|
||||||
range = 80f;
|
range = 80f;
|
||||||
bullet = BulletType.emp;
|
bullet = BulletType.small;
|
||||||
|
hitbox.setSize(7f);
|
||||||
|
|
||||||
heal();
|
heal();
|
||||||
|
|
||||||
|
Timers.reset(this, "salvo", 0);
|
||||||
|
Timers.reset(this, "shotgun", 0);
|
||||||
|
Timers.reset(this, "circle", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void updateShooting(){
|
void updateShooting(){
|
||||||
if(Timers.getTime(this, "salvo") < 30){
|
Timers.get(this, "salvo", 200);
|
||||||
if(Timers.get(this, "salvoShoot", 6)){
|
|
||||||
shoot(BulletType.shot2);
|
|
||||||
}
|
|
||||||
|
|
||||||
Timers.get(this, "salvo", 200);
|
if(Timers.getTime(this, "salvo") < 60){
|
||||||
|
if(Timers.get(this, "salvoShoot", 5)){
|
||||||
|
shoot(BulletType.flame, Mathf.range(20f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Timers.get(this, "shotgun", 50)){
|
if(Timers.get(this, "shotgun", 80)){
|
||||||
Angles.shotgun(5, 10f, 0f, f->{
|
Angles.shotgun(5, 10f, 0f, f->{
|
||||||
shoot(BulletType.purple, f);
|
shoot(BulletType.small, f);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Timers.get(this, "circle", 200)){
|
||||||
|
Angles.circle(8, f->{
|
||||||
|
shoot(BulletType.small, f);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,12 +162,12 @@ public class ProductionBlocks{
|
|||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
|
|
||||||
if(tile.floor().drops != null && Timers.get(tile, 60 * time)){
|
if(tile.floor().drops != null && Timers.get(tile, "drill", 60 * time)){
|
||||||
offloadNear(tile, tile.floor().drops.item);
|
offloadNear(tile, tile.floor().drops.item);
|
||||||
Effects.effect("sparkbig", tile.worldx(), tile.worldy());
|
Effects.effect("sparkbig", tile.worldx(), tile.worldy());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Timers.get(tile.hashCode() + "dump", 30)){
|
if(Timers.get(tile, "dump", 30)){
|
||||||
tryDump(tile);
|
tryDump(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class LiquidRouter extends LiquidBlock{
|
|||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
LiquidEntity entity = tile.entity();
|
LiquidEntity entity = tile.entity();
|
||||||
|
|
||||||
if(Timers.get(tile, 2) && entity.liquidAmount > 0){
|
if(Timers.get(tile, "dump", 2) && entity.liquidAmount > 0){
|
||||||
if(lastmap.get(tile, (byte)-1) != tile.rotation){
|
if(lastmap.get(tile, (byte)-1) != tile.rotation){
|
||||||
tryMoveLiquid(tile, tile.getNearby()[tile.rotation]);
|
tryMoveLiquid(tile, tile.getNearby()[tile.rotation]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class Router extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
if(Timers.get(tile, 2) && tile.entity.totalItems() > 0){
|
if(Timers.get(tile, "dump", 2) && tile.entity.totalItems() > 0){
|
||||||
if(lastmap.get(tile, (byte)-1) != tile.rotation)
|
if(lastmap.get(tile, (byte)-1) != tile.rotation)
|
||||||
tryDump(tile, tile.rotation, null);
|
tryDump(tile, tile.rotation, null);
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class Crafter extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
|
|
||||||
if(Timers.get(tile, 20) && tile.entity.hasItem(result)){
|
if(Timers.get(tile, "dump", 20) && tile.entity.hasItem(result)){
|
||||||
tryDump(tile, -1, result);
|
tryDump(tile, -1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,8 +35,6 @@ public class Crafter extends Block{
|
|||||||
|
|
||||||
offloadNear(tile, result);
|
offloadNear(tile, result);
|
||||||
Effects.effect("smelt", tile.entity);
|
Effects.effect("smelt", tile.entity);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ public class Drill extends Block{
|
|||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
|
|
||||||
//drills can only hold up to 10 items at a time
|
//drills can only hold up to 10 items at a time
|
||||||
if(tile.floor() == resource && Timers.get(tile, 60 * time) && tile.entity.totalItems() < 10){
|
if(tile.floor() == resource && Timers.get(tile, "drill", 60 * time) && tile.entity.totalItems() < 10){
|
||||||
offloadNear(tile, result);
|
offloadNear(tile, result);
|
||||||
Effects.effect("spark", tile.worldx(), tile.worldy());
|
Effects.effect("spark", tile.worldx(), tile.worldy());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Timers.get(tile.hashCode(), "dump", 30)){
|
if(Timers.get(tile, "dump", 30)){
|
||||||
tryDump(tile);
|
tryDump(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||