Updated spawn lists, other minor fixes
This commit is contained in:
@@ -1,22 +1,30 @@
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class EnemySpawn{
|
||||
public final Class<? extends Enemy> type;
|
||||
int before = Integer.MAX_VALUE;
|
||||
int after;
|
||||
int spacing = 1;
|
||||
float scaling = 9999f;
|
||||
protected int before = Integer.MAX_VALUE;
|
||||
protected int after;
|
||||
protected int spacing = 1;
|
||||
protected int tierscale = 15;
|
||||
protected int tierscaleback = 1;
|
||||
protected int max = 17;
|
||||
protected float scaling = 9999f;
|
||||
|
||||
public EnemySpawn(Class<? extends Enemy> type){
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int evaluate(int wave, int lane){
|
||||
if(wave < after || wave > before || wave % spacing != 0){
|
||||
if(wave < after || wave > before || (wave - after) % spacing != 0){
|
||||
return 0;
|
||||
}
|
||||
return 1 * Math.max((int)((wave / spacing) / scaling), 1);
|
||||
return Math.min(1 * Math.max((int)((wave / spacing) / scaling), 1) - (tier(wave, lane)-1) * tierscaleback, max);
|
||||
}
|
||||
|
||||
public int tier(int wave, int lane){
|
||||
return Mathf.clamp(1 + (wave-after)/tierscale, 1, Enemy.maxtier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public class Player extends DestructibleEntity{
|
||||
Effects.sound("die", this);
|
||||
|
||||
Vars.control.setRespawnTime(respawnduration);
|
||||
ui.fadeRespawn(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,8 @@ import io.anuke.ucore.entities.*;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class Enemy extends DestructibleEntity{
|
||||
public final static Color[] tierColors = {Color.YELLOW, Color.MAGENTA, Color.RED};
|
||||
public final static Color[] tierColors = {Color.YELLOW, Color.ORANGE, Color.RED, Color.MAGENTA};
|
||||
public final static int maxtier = 4;
|
||||
|
||||
protected float speed = 0.3f;
|
||||
protected float reload = 40;
|
||||
@@ -38,7 +39,7 @@ public class Enemy extends DestructibleEntity{
|
||||
public Vector2 direction = new Vector2();
|
||||
public float xvelocity, yvelocity;
|
||||
public Entity target;
|
||||
public int tier = Mathf.random(1, 3);
|
||||
public int tier = 1;
|
||||
|
||||
|
||||
public Enemy(int spawn){
|
||||
@@ -64,11 +65,11 @@ public class Enemy extends DestructibleEntity{
|
||||
target = World.findTileTarget(x, y, null, range, false);
|
||||
|
||||
//no tile found
|
||||
if(target == null)
|
||||
if(target == null){
|
||||
target = Entities.getClosest(x, y, range, e->{
|
||||
return e instanceof Player;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(target != null && bullet != null){
|
||||
@@ -162,8 +163,9 @@ public class Enemy extends DestructibleEntity{
|
||||
public void draw(){
|
||||
Draw.color();
|
||||
|
||||
String region = ClassReflection.getSimpleName(getClass()).toLowerCase() + "-t" + tier;
|
||||
String region = ClassReflection.getSimpleName(getClass()).toLowerCase() + "-t" + Mathf.clamp(tier, 1, 3);
|
||||
|
||||
//TODO is this necessary?
|
||||
Draw.getShader(Outline.class).color.set(tierColors[tier-1]);
|
||||
Draw.getShader(Outline.class).region = Draw.region(region);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user