Added sprites for new enemies, various tweaks

This commit is contained in:
Anuken 2017-11-05 22:36:22 -05:00
parent cfdcfe8309
commit c36d985054
25 changed files with 299 additions and 215 deletions

View File

@ -79,7 +79,7 @@ project(":core") {
apply plugin: "java"
dependencies {
compile 'com.github.anuken:ucore:01b71b6dbd'
compile 'com.github.anuken:ucore:2d86b0497e'
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -408,7 +408,12 @@ public class Control extends Module{
}
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();
}
}
}

View File

@ -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;
hitsize = 6f;
@ -73,7 +73,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
public void removed(Bullet b){
Timers.run(5f, ()->{
new EMP(b.x, b.y).add();
new EMP(b.x, b.y, b.damage).add();
});
Effects.effect("empshockwave", b);
Effects.shake(3f, 3f, b);

View File

@ -61,7 +61,7 @@ public class Player extends DestructibleEntity{
if(Vars.debug && Inputs.keyDown(Keys.SHIFT_LEFT))
speed *= 3f;
if(health < maxhealth && Timers.get(this, 50))
if(health < maxhealth && Timers.get(this, "regen", 50))
health ++;
vector.set(0, 0);

View File

@ -22,7 +22,8 @@ public class EMP extends TimedEntity{
int damage = 6;
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);
lifetime = 30f;
@ -73,11 +74,10 @@ public class EMP extends TimedEntity{
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);
drawLine(x + Angles.x(), y + Angles.y());
}
Draw.thick(fract()*2f);
Draw.circle(x, y, radius * Vars.tilesize);

View File

@ -7,11 +7,12 @@ public class EmpEnemy extends Enemy{
public EmpEnemy(int spawn) {
super(spawn);
speed = 0.4f;
reload = 50;
speed = 0.27f;
reload = 70;
maxhealth = 210;
range = 80f;
bullet = BulletType.emp;
turretrotatespeed = 0.1f;
heal();
}

View File

@ -26,6 +26,7 @@ public class Enemy extends DestructibleEntity{
protected float length = 4;
protected float rotatespeed = 7f;
protected float turretrotatespeed = 0.2f;
protected boolean alwaysRotate = false;
protected BulletType bullet = BulletType.small;
protected String shootsound = "enemyshoot";
protected int damage;
@ -60,7 +61,7 @@ public class Enemy extends DestructibleEntity{
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);
//no tile found
@ -131,6 +132,7 @@ public class Enemy extends DestructibleEntity{
speed += 0.04f*tier + Mathf.range(0.1f);
reload /= Math.max(tier / 1.5f, 1f);
range += tier*5;
speed = Math.max(speed, 0.07f);
heal();
}
@ -165,8 +167,8 @@ public class Enemy extends DestructibleEntity{
xvelocity = (x - lastx) / Timers.delta();
yvelocity = (y - lasty) / Timers.delta();
if(target == null){
direction.add(xvelocity * Timers.delta(), yvelocity * Timers.delta());
if(target == null || alwaysRotate){
direction.add(xvelocity * Timers.delta() / 3f, yvelocity * Timers.delta() / 3f);
direction.limit(speed*rotatespeed);
}else{
float angle = angleTo(target);

View File

@ -17,12 +17,13 @@ public class HealerEnemy extends Enemy{
public HealerEnemy(int spawn) {
super(spawn);
speed = 0.4f;
speed = 0.2f;
reload = 30;
maxhealth = 210;
range = 80f;
range = 90f;
bullet = BulletType.shot;
range = 30f;
alwaysRotate = false;
heal();
}
@ -34,8 +35,8 @@ public class HealerEnemy extends Enemy{
move(vec.x*Timers.delta(), vec.y*Timers.delta());
if(Timers.get(this, 15)){
target = Entities.getClosest(x, y, range, e->e instanceof Enemy);
if(Timers.get(this, "target", 15)){
target = Entities.getClosest(x, y, range, e->e instanceof Enemy && e != this && ((Enemy)e).healthfrac() < 1f);
}
if(target != null){
@ -57,12 +58,14 @@ public class HealerEnemy extends Enemy{
super.drawOver();
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){
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time()) + 1f) / 14f));
Draw.alpha(0.3f);
Draw.laser("laser", "laserend", x + Angles.x(), y + Angles.y(), enemy.x, enemy.y);
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time()) + 1f) / 13f));
Draw.alpha(0.9f);
Draw.laser("laser", "laserend", x + Angles.x(), y + Angles.y(), enemy.x - Angles.x()/1.5f, enemy.y - Angles.y()/1.5f);
Draw.color();
}
}

View File

@ -3,34 +3,46 @@ package io.anuke.mindustry.entities.enemies;
import io.anuke.mindustry.entities.BulletType;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class TitanEnemy extends Enemy{
public TitanEnemy(int spawn) {
super(spawn);
speed = 0.4f;
speed = 0.1f;
reload = 30;
maxhealth = 210;
range = 80f;
bullet = BulletType.emp;
bullet = BulletType.small;
hitbox.setSize(7f);
heal();
Timers.reset(this, "salvo", 0);
Timers.reset(this, "shotgun", 0);
Timers.reset(this, "circle", 0);
}
@Override
void updateShooting(){
if(Timers.getTime(this, "salvo") < 30){
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));
}
Timers.get(this, "salvo", 200);
}
if(Timers.get(this, "shotgun", 50)){
if(Timers.get(this, "shotgun", 80)){
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);
});
}
}

View File

@ -162,12 +162,12 @@ public class ProductionBlocks{
@Override
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);
Effects.effect("sparkbig", tile.worldx(), tile.worldy());
}
if(Timers.get(tile.hashCode() + "dump", 30)){
if(Timers.get(tile, "dump", 30)){
tryDump(tile);
}
}

View File

@ -26,7 +26,7 @@ public class LiquidRouter extends LiquidBlock{
public void update(Tile tile){
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){
tryMoveLiquid(tile, tile.getNearby()[tile.rotation]);
}

View File

@ -26,7 +26,7 @@ public class Router extends Block{
@Override
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)
tryDump(tile, tile.rotation, null);

View File

@ -19,7 +19,7 @@ public class Crafter extends Block{
@Override
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);
}
@ -35,8 +35,6 @@ public class Crafter extends Block{
offloadNear(tile, result);
Effects.effect("smelt", tile.entity);
}
@Override

View File

@ -23,12 +23,12 @@ public class Drill extends Block{
public void update(Tile tile){
//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);
Effects.effect("spark", tile.worldx(), tile.worldy());
}
if(Timers.get(tile.hashCode(), "dump", 30)){
if(Timers.get(tile, "dump", 30)){
tryDump(tile);
}
}