Skip to content

Commit

Permalink
Bug fixed: walk through opponent's walls
Browse files Browse the repository at this point in the history
  • Loading branch information
karin committed Oct 25, 2017
1 parent 2ed312f commit be8c597
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
8 changes: 6 additions & 2 deletions core/src/com/ru/tgra/shapes/Maze.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ public void addRandomWalls(int n, int curX, int curZ) {

public void addWall(Wall wall) {
this.innerWallsToBe.add(wall);
if (wall.isParallelToX())
this.maze[wall.getZ() - 1][wall.getX()].addNorthWall();
else
this.maze[wall.getZ()][wall.getX() - 1].addEastWall();
}

public void raiseWalls(float raiseFor) {
Expand Down Expand Up @@ -239,11 +243,11 @@ public void draw(Shader3D shader) {
BoxGraphic.drawSolidCube();
}

private Wall addNorthWall() {
public Wall addNorthWall() {
this.northWall = true;
return new Wall(this.unit * this.wallWidth, this.unit, true,(this.posX + 0.5f) * this.unit, (this.posZ + 1) * this.unit);
}
private Wall addEastWall() {
public Wall addEastWall() {
this.eastWall = true;
return new Wall(this.unit * this.wallWidth, this.unit, false,(this.posX + 1) * this.unit, (this.posZ + 0.5f) * this.unit);
}
Expand Down
12 changes: 12 additions & 0 deletions core/src/com/ru/tgra/shapes/Wall.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,16 @@ public void reflect() {
this.centerZ = x;
this.parallelToX = !this.parallelToX;
}

public int getX() {
return (int) this.centerX;
}

public int getZ() {
return (int) this.centerZ;
}

public boolean isParallelToX() {
return this.parallelToX;
}
}
4 changes: 2 additions & 2 deletions serverCode/GameServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public void run() {

if (msg_received.text().length() == 0) // invalid message
continue;
if (msg_received.text().split("kkk")[0].equals("newwall"))
System.out.println("[new data] [" + msg_received.sender() + "] : " + msg_received.text() + msg_received.time()); // print the incoming message in the console
//if (msg_received.text().split("kkk")[0].equals("newwall"))
// System.out.println("[new data] [" + msg_received.sender() + "] : " + msg_received.text() + msg_received.time()); // print the incoming message in the console

Message msg_send = msg_received;
try {
Expand Down

0 comments on commit be8c597

Please sign in to comment.