Skip to content

Commit

Permalink
Merge pull request #32 from Interrupt/texture-panning
Browse files Browse the repository at this point in the history
Making Elevator Triggers pan their wall textures
  • Loading branch information
Interrupt authored Oct 14, 2020
2 parents 13eccab + cb3d04e commit e436872
Show file tree
Hide file tree
Showing 12 changed files with 509 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3490,6 +3490,24 @@ else if(pickedSurface.edge == TileEdges.West) {
floodFillWallTexture(x - nextXOffset, y - nextYOffset, checkTex, checkAtlas, adjacent);
}

public void panSurfaceY(float amt) {
if(pickedSurface.isPicked) {
Tile t = level.getTileOrNull((int) pickedSurface.position.x, (int) pickedSurface.position.z);
if(t == null)
return;

boolean isUpperWall = pickedSurface.tileSurface == TileSurface.UpperWall;

if(isUpperWall)
t.offsetTopWallSurfaces(pickedSurface.edge, amt);
else
t.offsetBottomWallSurfaces(pickedSurface.edge, amt);

markWorldAsDirty((int)pickedSurface.position.x, (int)pickedSurface.position.y, 1);
history.saveState(level);
}
}

public TextureRegion[] loadAtlas(String texture, int spritesHorizontal, boolean filter) {
Texture spriteTextures = Art.loadTexture(texture);

Expand Down
Binary file added Dungeoneer/assets/levels/features/elevators.bin
Binary file not shown.
Binary file modified Dungeoneer/assets/levels/test-level.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
public class PathNode extends Entity {
public transient short playerSmell = 0;
public short weight = 0;
public boolean nodeEnabled = true;

private transient Array<PathNode> connections = new Array<PathNode>();
private transient Array<PathNode> jumps = new Array<PathNode>();
Expand Down Expand Up @@ -82,7 +83,7 @@ public void walk(int iteration, PathNode previous) {
// normal connections
for (int i = 0; i < connections.size; i++) {
PathNode node = connections.get(i);
if(node != previous) {
if(node != previous && node.nodeEnabled) {
node.walk(iteration, this);
}
}
Expand All @@ -94,4 +95,10 @@ public void reset() {
playerSmell = Short.MAX_VALUE;
}
}

public void setEnabled(boolean isEnabled) {
synchronized (this) {
this.nodeEnabled = isEnabled;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class PositionedSound extends Entity {
protected transient Long soundInstance = null;

@EditorProperty
protected float volume = 1f;
public float volume = 1f;

@EditorProperty
public float radius = 12f;
Expand Down
Loading

0 comments on commit e436872

Please sign in to comment.