mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-03-03 16:49:45 +01:00
Update Robot.java
Legger til felt for sjekk om en robot har besøkt et flagg i løpet av runden eller ikke. Co-Authored-By: gabrielmagnus <gabrielmagnus@users.noreply.github.com>
This commit is contained in:
parent
1bac54b062
commit
9f843b8db6
@ -16,6 +16,7 @@ public class Robot {
|
|||||||
private Position backupPosition;
|
private Position backupPosition;
|
||||||
private Position currentPosition;
|
private Position currentPosition;
|
||||||
private Direction facingDirection;
|
private Direction facingDirection;
|
||||||
|
private boolean hasTouchedFlagThisTurn = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new robot
|
* Instantiates a new robot
|
||||||
@ -29,6 +30,23 @@ public class Robot {
|
|||||||
this.facingDirection = Direction.NORTH;
|
this.facingDirection = Direction.NORTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if the robot has touched a flag in the current turn
|
||||||
|
* @return a boolean
|
||||||
|
*/
|
||||||
|
public boolean isHasTouchedFlagThisTurn() {
|
||||||
|
return hasTouchedFlagThisTurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the boolean value to true if the robot touches a flag during a turn,
|
||||||
|
* and false at the end of each turn.
|
||||||
|
* @param hasTouchedFlagThisTurn the boolean value to be set.
|
||||||
|
*/
|
||||||
|
public void setHasTouchedFlagThisTurn(boolean hasTouchedFlagThisTurn) {
|
||||||
|
this.hasTouchedFlagThisTurn = hasTouchedFlagThisTurn;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the damage the robot has taken
|
* Gets the damage the robot has taken
|
||||||
* @return The amount of damage the robot has received
|
* @return The amount of damage the robot has received
|
||||||
|
Loading…
x
Reference in New Issue
Block a user