Broken attempt at per-enemy pathfinding; balancing

This commit is contained in:
Anuken
2017-11-23 20:58:32 -05:00
parent 88e4154ea3
commit b2cd95899c
12 changed files with 93 additions and 54 deletions

View File

@@ -47,7 +47,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
Draw.reset();
}
},
sniper = new BulletType(3f, 23){
sniper = new BulletType(3f, 25){
public void draw(Bullet b){
Draw.color(Color.LIGHT_GRAY);
Draw.thick(1f);
@@ -223,7 +223,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
Draw.reset();
}
},
flame = new BulletType(0.6f, 4){
flame = new BulletType(0.6f, 5){
public void draw(Bullet b){
Draw.color(Color.YELLOW, Color.SCARLET, b.time/lifetime);
float size = 6f-b.time/lifetime*5f;
@@ -250,7 +250,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
Draw.reset();
}
},
shot = new BulletType(2.4f, 2){
shot = new BulletType(2.4f, 4){
{lifetime = 40;}
public void draw(Bullet b){
Draw.color(lightGold);
@@ -258,7 +258,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
Draw.reset();
}
},
multishot = new BulletType(2.5f, 2){
multishot = new BulletType(2.5f, 3){
{lifetime=40;}
public void draw(Bullet b){
Draw.color(Color.SKY);

View File

@@ -1,5 +1,7 @@
package io.anuke.mindustry.entities.enemies;
import com.badlogic.gdx.ai.pfa.PathFinder;
import com.badlogic.gdx.ai.pfa.PathFinderRequest;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
@@ -7,6 +9,7 @@ import com.badlogic.gdx.utils.reflect.ClassReflection;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.ai.Pathfind;
import io.anuke.mindustry.ai.SmoothGraphPath;
import io.anuke.mindustry.entities.Bullet;
import io.anuke.mindustry.entities.BulletType;
import io.anuke.mindustry.entities.Player;
@@ -34,9 +37,11 @@ public class Enemy extends DestructibleEntity{
protected String shootsound = "enemyshoot";
protected int damage;
public Tile[] path;
public PathFinderRequest<Tile> request = new PathFinderRequest<>();;
public SmoothGraphPath gpath;
public int spawn;
public int node = -1;
public PathFinder<Tile> finder;
public Vector2 direction = new Vector2();
public float xvelocity, yvelocity;
@@ -122,6 +127,7 @@ public class Enemy extends DestructibleEntity{
public void findClosestNode(){
Pathfind.find(this);
/*
int index = 0;
int cindex = -1;
@@ -147,7 +153,7 @@ public class Enemy extends DestructibleEntity{
Timers.run(Mathf.random(15f), ()->{
set(x2 * Vars.tilesize, y2 * Vars.tilesize);
});
}
}*/
}
@Override