mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
added a lot more comments to player
This commit is contained in:
parent
3849e1b8fc
commit
3bd9681d22
@ -7,16 +7,16 @@ import inf112.fiasko.roborally.element_properties.Position;
|
||||
*/
|
||||
public class Robot {
|
||||
private int robotDamageTaken = 0;
|
||||
private final int playerId; //might not be needed
|
||||
private final int playerId;
|
||||
private boolean inPowerDown = false;
|
||||
private int lastFlagVisited = 0;
|
||||
private Position backupPosition;
|
||||
private Position currentPosition;
|
||||
|
||||
/**
|
||||
*
|
||||
* Instantiates a new robot
|
||||
* @param playerId gives the robot a identifier that links it too the correct player
|
||||
* @param spawnPosition
|
||||
* @param spawnPosition gives the robot its starting position on the map
|
||||
*/
|
||||
public Robot (int playerId, Position spawnPosition){
|
||||
this.playerId=playerId;
|
||||
@ -24,24 +24,62 @@ public class Robot {
|
||||
this.currentPosition = spawnPosition;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the damage the robot has taken
|
||||
* @return the amount of damage the robot has received
|
||||
*/
|
||||
public int getDamage(){
|
||||
return robotDamageTaken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the robot's damage too a given amount
|
||||
* @param damage the amount of damage the robot has received
|
||||
*/
|
||||
public void setDamage (int damage){
|
||||
this.robotDamageTaken = damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the robot's current position on the map
|
||||
* @return the robot's current position
|
||||
*/
|
||||
public Position getPosition(){
|
||||
return currentPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* places the robot on a new position
|
||||
* @param newPosition the new position for the robot
|
||||
*/
|
||||
public void setPosition( Position newPosition ){
|
||||
this.currentPosition = newPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Places the status of the powerdown field
|
||||
* @param powerDownStatus True if robot is going to go to powerdown. False otherwise
|
||||
*/
|
||||
public void setPowerDown(Boolean powerDownStatus){
|
||||
this.inPowerDown = powerDownStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status of the robot's powerdown field
|
||||
* @return robot's powerdown status
|
||||
*/
|
||||
public Boolean isInPowerDown(){
|
||||
return inPowerDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the robot's last visited flag too the new flag and places its backup on the flags position
|
||||
* @param currentFlag the flag the robot is standing on
|
||||
* @param newBackupPosition the position of the flag
|
||||
*/
|
||||
public void setLastFlagVisitedAndBackupPosition(int currentFlag, Position newBackupPosition){
|
||||
this.lastFlagVisited=currentFlag;
|
||||
this.backupPosition=newBackupPosition;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user