Pathfinding fixes
This commit is contained in:
@@ -2,6 +2,7 @@ package io.anuke.mindustry;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.ai.Pathfind;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
@@ -47,6 +48,8 @@ public class GameState{
|
|||||||
int amount = wave;
|
int amount = wave;
|
||||||
Sounds.play("spawn");
|
Sounds.play("spawn");
|
||||||
|
|
||||||
|
Pathfind.updatePath();
|
||||||
|
|
||||||
for(int i = 0; i < amount; i ++){
|
for(int i = 0; i < amount; i ++){
|
||||||
int pos = i;
|
int pos = i;
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ public class Input{
|
|||||||
tile.setBlock(recipe.result);
|
tile.setBlock(recipe.result);
|
||||||
tile.rotation = rotation;
|
tile.rotation = rotation;
|
||||||
|
|
||||||
Pathfind.updatePath();
|
|
||||||
|
|
||||||
Effects.effect("place", World.roundx(), World.roundy());
|
Effects.effect("place", World.roundx(), World.roundy());
|
||||||
Effects.shake(2f, 2f);
|
Effects.shake(2f, 2f);
|
||||||
Sounds.play("place");
|
Sounds.play("place");
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class Enemy extends DestructibleEntity{
|
|||||||
Vector2 vec = Pathfind.find(this);
|
Vector2 vec = Pathfind.find(this);
|
||||||
vec.sub(x, y).setLength(speed);
|
vec.sub(x, y).setLength(speed);
|
||||||
|
|
||||||
move(vec.x*delta, vec.y*delta);
|
move(vec.x*delta, vec.y*delta, Vars.tilesize-4);
|
||||||
|
|
||||||
if(Timers.get(this, 15)){
|
if(Timers.get(this, 15)){
|
||||||
target = World.findTileTarget(x, y, null, range, false);
|
target = World.findTileTarget(x, y, null, range, false);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package io.anuke.mindustry.entities;
|
|||||||
import com.badlogic.gdx.utils.ObjectMap;
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
|
|
||||||
import io.anuke.mindustry.GameState;
|
import io.anuke.mindustry.GameState;
|
||||||
import io.anuke.mindustry.ai.Pathfind;
|
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.Blocks;
|
import io.anuke.mindustry.world.blocks.Blocks;
|
||||||
@@ -37,7 +36,6 @@ public class TileEntity extends Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
tile.setBlock(Blocks.air);
|
tile.setBlock(Blocks.air);
|
||||||
Pathfind.updatePath();
|
|
||||||
Effects.shake(4f, 4f);
|
Effects.shake(4f, 4f);
|
||||||
Effects.effect("explosion", this);
|
Effects.effect("explosion", this);
|
||||||
|
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public class WeaponBlocks{
|
|||||||
protected void shoot(Tile tile){
|
protected void shoot(Tile tile){
|
||||||
TurretEntity entity = tile.entity();
|
TurretEntity entity = tile.entity();
|
||||||
|
|
||||||
for(int i = 0; i < 6; i ++)
|
for(int i = 0; i < 7; i ++)
|
||||||
Timers.run(i/1.5f, ()->{
|
Timers.run(i/1.5f, ()->{
|
||||||
vector.set(4, 0).setAngle(entity.rotation);
|
vector.set(4, 0).setAngle(entity.rotation);
|
||||||
bullet(tile, entity.rotation + Mathf.range(16));
|
bullet(tile, entity.rotation + Mathf.range(30));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user