pathfinding bug fixed

shops
Ivory 2023-07-01 06:10:16 -04:00
parent 7afa863ee8
commit 634f48d941
7 changed files with 22 additions and 17 deletions

View File

@ -25,7 +25,8 @@ public class App {
// The window handle
private long window;
private int width = 1024, height = 576;
// private int width = 1024, height = 576;
private int width = 1600, height = 900;
private Matrix4f matrix = Matrix4f.orthographic(0, width, height, 0, 0, 100);
public static int mouseX, mouseY;
@ -69,7 +70,7 @@ public class App {
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // the window will be resizable
// Create the window
window = glfwCreateWindow(width, height, "Hello World!", NULL, NULL);
window = glfwCreateWindow(width, height, "Val Engine", NULL, NULL);
if ( window == NULL )
throw new RuntimeException("Failed to create the GLFW window");
@ -94,11 +95,6 @@ public class App {
game.scrollUp();
else if(yOffset < 0)
game.scrollDown();
// if(yOffset > 0)
// game.scrollLeft();
// else if(yOffset < 0)
// game.scrollRight();
});
glfwSetMouseButtonCallback(window, (long window, int button, int action, int mods) -> {

View File

@ -216,7 +216,7 @@ public class Camera extends GameObject implements ITransient, IMouseCaptureArea
@Override
public void scrollUp() {
tileWidth *= 2;
tileWidth = Math.min(tileWidth, 32);
tileWidth = Math.min(tileWidth, 64);
}
}

View File

@ -122,7 +122,7 @@ public class BuildLayer extends GameObject implements IMouseCaptureArea, ITransi
@Override
public List<Box> getGuiBoxes() {
return List.of(active ? new Box(0, 0, 1024, 576) : Box.none);
return List.of(active ? new Box(0, 0, App., 576) : Box.none);
}
@Override

View File

@ -132,7 +132,7 @@ public class SelectionUI extends ImmediateUI implements ISelectionChangeListener
if(details.length == 0) {
text("No details available.");
} else for(Detail detail : details) {
text(detail.toString(30));
text(detail.toString(20));
}
});
} else {

View File

@ -111,6 +111,7 @@ public class Tree extends WorldObject implements ISelectable, IWorkable {
@Override
protected void beforeRemoved() {
super.beforeRemoved();
Vector2i pos = getWorldPosition().xy();
add(new Log(pos.x, pos.y));
}

View File

@ -68,13 +68,14 @@ public abstract class WorldObject extends GameObject implements IWorldObject {
tile.placeThing(this);
}
if(linkedTiles.size() == 0 && inScene()) {
remove(this);
}
// ?? this shouldnt bew pivotal to anything?
// if(linkedTiles.size() == 0 && inScene()) {
// remove(this);
// }
if(linkedTiles.size() != 0 && !inScene()) {
add(this);
}
// if(linkedTiles.size() != 0 && !inScene()) {
// add(this);
// }
}
@ -133,4 +134,11 @@ public abstract class WorldObject extends GameObject implements IWorldObject {
return new Box(x, y, w, h);
}
@Override
protected void beforeRemoved() {
for(Tile tile : this.getTiles()) {
tile.removeThing(this);
}
}
}

View File

@ -240,6 +240,6 @@ public class Pawn extends Agent {
@Override
public boolean isWalkable() {
// TODO thiss could be an interesting mechanic, but it may be bad
return false;
return true;
}
}