mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-19 16:57:20 +07:00
Fixed quillrat missile
Fixed quillrat missile initial direction Exposed Entity.screen vector Integrated EngineUtils into Missile updates
This commit is contained in:
parent
b9b74768ee
commit
60ecc72fca
@ -11,6 +11,7 @@ import com.riiablo.entity.Entity;
|
||||
import com.riiablo.entity.Missile;
|
||||
import com.riiablo.entity.Monster;
|
||||
import com.riiablo.entity.Player;
|
||||
import com.riiablo.util.EngineUtils;
|
||||
|
||||
public class QuillRat extends AI {
|
||||
enum State implements com.badlogic.gdx.ai.fsm.State<Monster> {
|
||||
@ -79,6 +80,7 @@ public class QuillRat extends AI {
|
||||
|
||||
Missile miss = new Missile(missile);
|
||||
miss.position().set(entity.position());
|
||||
EngineUtils.worldToScreenCoords(miss.position(), miss.screen());
|
||||
miss.lookAt(ent); // TODO: should be able to set angle to firing entity angle later
|
||||
Riiablo.engine.add(miss);
|
||||
return;
|
||||
|
@ -565,6 +565,10 @@ public abstract class Entity implements Animation.AnimationListener {
|
||||
return position;
|
||||
}
|
||||
|
||||
public Vector2 screen() {
|
||||
return screen;
|
||||
}
|
||||
|
||||
public boolean contains(Vector2 coords) {
|
||||
if (animation == null) return false;
|
||||
if (!isSelectable()) return false;
|
||||
|
@ -12,6 +12,7 @@ import com.riiablo.codec.excel.Missiles;
|
||||
import com.riiablo.graphics.BlendMode;
|
||||
import com.riiablo.graphics.PaletteIndexedBatch;
|
||||
import com.riiablo.map.DT1.Tile;
|
||||
import com.riiablo.util.EngineUtils;
|
||||
|
||||
public class Missile extends Entity {
|
||||
public final Missiles.Entry missile;
|
||||
@ -54,8 +55,7 @@ public class Missile extends Entity {
|
||||
//position.add(tmpVec2);
|
||||
|
||||
radius *= Tile.SUBTILE_WIDTH; // workaround to get approx speed
|
||||
tmpVec2.x = +(position.x * Tile.SUBTILE_WIDTH50) - (position.y * Tile.SUBTILE_WIDTH50);
|
||||
tmpVec2.y = -(position.x * Tile.SUBTILE_HEIGHT50) - (position.y * Tile.SUBTILE_HEIGHT50);
|
||||
EngineUtils.worldToScreenCoords(position, tmpVec2);
|
||||
tmpVec2.x += radius * MathUtils.cos(angle);
|
||||
tmpVec2.y += radius * MathUtils.sin(angle);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user