public int getTileY() { return y * Settings.getTileSize(); }
public int getTileX() { return x * Settings.getTileSize(); }
public AnimatedEntityStrip(Drawable drawable, int frames, float speed) { this(drawable, frames, speed, new Rectangle(0, 0, Settings.getTileSize(), Settings.getTileSize()), 0, 0); }
public AnimatedEntity(Drawable drawable, float speed) { this(drawable, speed, new Rectangle(0, 0, Settings.getTileSize(), Settings.getTileSize()), 0, 0); }
public WorldObject(float x, float y, float width, float height) { this.pos = new Vector2(x, y); this.last = new Vector2(x, y); this.desired = new Vector2(x, y); this.width = width; this.height = height; boundOffset = new Rectangle(0, 0, Settings.getTileSize(), Settings.getTileSize()); }
public void setPath(PathFinder finder, Node goal, boolean[][] walkables) { if (goal != null) { path.clear(); path = finder.findPath(new Node((int)(pos.x / Settings.getTileSize()), (int)(pos.y / Settings.getTileSize())), goal, walkables); goalNode = goal; } else { goalNode = null; path.clear(); } }
public void focusCamera(int width, int height, OrthoCamera camera) { float camX = 0, camY = 0; if (width * Settings.getTileSize() - pos.x >= (Settings.getWidth() / 2) * camera.zoom) camX = pos.x; else if (width * Settings.getTileSize() - pos.x <= (Settings.getWidth() / 2) * camera.zoom && pos.x > (Settings.getWidth() / 2) * camera.zoom) camX = width * Settings.getTileSize() - (Settings.getWidth() / 2) * camera.zoom; if (pos.x <= (Settings.getWidth() / 2) * camera.zoom) camX = (Settings.getWidth() / 2) * camera.zoom; else if (pos.x > (Settings.getWidth() / 2) * camera.zoom && pos.x < width * Settings.getTileSize() - (Settings.getWidth() / 2) * camera.zoom) camX = pos.x; if (height * Settings.getTileSize() - pos.y > (Settings.getHeight() / 2) * camera.zoom) camY = pos.y; else if (height * Settings.getTileSize() - pos.y <= (Settings.getHeight() / 2) * camera.zoom) camY = height * Settings.getTileSize() - (Settings.getHeight() / 2) * camera.zoom; if (pos.y <= (Settings.getHeight() / 2) * camera.zoom) camY = (Settings.getHeight() / 2) * camera.zoom; else if (pos.y > (Settings.getHeight() / 2) * camera.zoom && pos.y < height * Settings.getTileSize() - (Settings.getHeight() / 2) * camera.zoom) camY = pos.y; if (camX != camera.getPos().x || camY != camera.getPos().y) camera.setPosition(camX, camY); }
private void walkToNode(Node next) { float xOffset = (Settings.getTileSize() - width) / 2; //xOffset centers the entity in the middle of the tile float yOffset = (Settings.getTileSize() - height) / 2;
Vector2 nextTile = normal.cpy().scl(index).scl(Settings.getTileSize()).add(newPos); int tileX = (int)(nextTile.x / Settings.getTileSize()); int tileY = (int)(nextTile.y / Settings.getTileSize()); if (tileX == woX && tileY == woY) { float nX = Math.abs(normal.x);