mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-06-28 04:04:42 +02:00
Flytter ting til korrekte pakker og forbedrer Tile og Wall
Fikser kommentarer, mellomrom og variabelnavn i Tile og Wall Flytter IGrid, Robot og Wall til objects Flytter tester til korresponderende pakker
This commit is contained in:
@ -1,37 +0,0 @@
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
/**
|
||||
* This Interface describes a grid
|
||||
* @param <K> type of element
|
||||
*/
|
||||
public interface IGrid<K> {
|
||||
|
||||
/**
|
||||
* returns the width of the grid
|
||||
* @return the width
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* returns the height of the grid
|
||||
* @return the height
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* returns the element in a given x and y coordinate
|
||||
* @param x coordinate in the grid
|
||||
* @param y coordinate in the grid
|
||||
* @return element in the x and y coordinate
|
||||
* @throws IllegalArgumentException throws exception if coordinates are not in the grid
|
||||
*/
|
||||
K getElement(int x,int y) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* places the element in the given x and y coordinate
|
||||
* @param x coordinate
|
||||
* @param y coordinate
|
||||
* @param element that is being placed in the grid
|
||||
*/
|
||||
void setElement(int x, int y, K element);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
/**
|
||||
* this class represtents a robot
|
||||
*/
|
||||
public class Robot {
|
||||
private int robotDamageTaken = 0;
|
||||
private int playerId; //might not be needed
|
||||
private boolean inPowerDown = false;
|
||||
private int lastFlagVisited = 0;
|
||||
private Position backupPosition;
|
||||
private Position currentPosition;
|
||||
|
||||
|
||||
public Robot (int playerId, Position spawnPosition){
|
||||
this.playerId=playerId;
|
||||
this.backupPosition = spawnPosition;
|
||||
this.currentPosition = spawnPosition;
|
||||
}
|
||||
|
||||
|
||||
public int getDamage(){
|
||||
return robotDamageTaken;
|
||||
}
|
||||
public void setDamage (int damage){
|
||||
this.robotDamageTaken = damage;
|
||||
}
|
||||
public Position getPosition(){
|
||||
return currentPosition;
|
||||
}
|
||||
public void setPosition( Position newPosition ){
|
||||
this.currentPosition = newPosition;
|
||||
}
|
||||
public void setPowerDown(Boolean powerDownStatus){
|
||||
this.inPowerDown = powerDownStatus;
|
||||
}
|
||||
public Boolean isInPowerDown(){
|
||||
return inPowerDown;
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
public class Wall {
|
||||
/**
|
||||
* This class is a representation of a wall
|
||||
*/
|
||||
private WallType wall;
|
||||
private Direction direction;
|
||||
|
||||
/**
|
||||
* Initializes the wall
|
||||
* @param wall gives the type of wall eks. wall normal or wall corner
|
||||
* @param direction gives the direction the wall is facing.
|
||||
*/
|
||||
public Wall (WallType wall,Direction direction){
|
||||
this.wall = wall;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the wall
|
||||
* @return the wall type
|
||||
*/
|
||||
public WallType getWallType() {
|
||||
return wall;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the direction of the wall
|
||||
* @return the direction of the wall
|
||||
*/
|
||||
public Direction getDirection(){
|
||||
return direction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user