File Parser for levels (#18)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Debucquoy Anthony (tonitch) <debucquoy.anthony@gmail.com> Reviewed-on: #18 Reviewed-by: Mat_02 <diletomatteo@gmail.com>
This commit was merged in pull request #18.
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package school_project;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Base class for everything that is a shape kind, like map and pieces
|
||||
* it contain a matrix of boolean where the shape is defined by the true's
|
||||
*/
|
||||
public class Shape {
|
||||
|
||||
public class Shape implements Serializable, Cloneable{
|
||||
|
||||
protected boolean[][] matrix;
|
||||
protected int height, width;
|
||||
|
||||
@@ -41,4 +43,17 @@ public class Shape {
|
||||
public boolean[][] getShape() {
|
||||
return matrix;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String ret = "";
|
||||
for (boolean[] row : matrix) {
|
||||
for (boolean el : row) {
|
||||
if(el) ret = ret.concat("⬛");
|
||||
else ret = ret.concat("⬜");
|
||||
}
|
||||
ret = ret.concat("\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user