Package ruscz.game.gameOfProd.Cells
Class Person
- java.lang.Object
-
- ruscz.game.gameOfProd.Cells.Cell
-
- ruscz.game.gameOfProd.Cells.Person
-
-
Field Summary
Fields Modifier and Type Field Description private intdirectionMoveprivate intdirectionMoveLastprivate intdirectionSightprivate intdistanceOfAnimationprivate ImagePersonimagePersonprivate static booleanisInEventprivate booleanisMovingprivate Mapmapprivate longtimeprivate intWALKING_SPEED
-
Method Summary
Modifier and Type Method Description voidanimateMove(java.awt.Graphics2D g, int direction)Animates Players move throughout the mapintgetDirectionMoveLast()intgetDirectionSight()intgetDistance()booleangetIsMoving()MapgetMap()private booleanisDoorInFront(int x, int y, int directionSight)Checks if there is a Door cell in front of Playerprivate booleanisEventInFront(int x, int y, int directionSight)Checks if there is an Event cell in front of Playerprivate booleanisChestInFront(int x, int y, int directionSight)Checks if there is a Chest cell in front of Playerstatic booleanisInEvent()voidmove()Checks for user input then checks if movement is possible then moves Playervoidpaint(java.awt.Graphics2D g)voidsetDirectionMove(int directionMove)voidsetDirectionMoveLast(int directionMoveLast)voidsetDirectionSight(int directionSight)voidsetDistance(int distance)voidsetImagePerson(java.lang.String name, java.awt.Rectangle[] rectangles)static voidsetInEvent(boolean isInEvent)voidsetIsMoving(boolean isMoving)
-
-
-
Field Detail
-
WALKING_SPEED
private final int WALKING_SPEED
- See Also:
- Constant Field Values
-
map
private final Map map
-
imagePerson
private ImagePerson imagePerson
-
directionMove
private int directionMove
-
directionSight
private int directionSight
-
directionMoveLast
private int directionMoveLast
-
isMoving
private boolean isMoving
-
isInEvent
private static boolean isInEvent
-
distanceOfAnimation
private int distanceOfAnimation
-
time
private long time
-
-
Method Detail
-
getMap
public Map getMap()
-
setDirectionMoveLast
public void setDirectionMoveLast(int directionMoveLast)
-
setDirectionSight
public void setDirectionSight(int directionSight)
-
setDirectionMove
public void setDirectionMove(int directionMove)
-
setImagePerson
public void setImagePerson(java.lang.String name, java.awt.Rectangle[] rectangles)
-
move
public void move()
Checks for user input then checks if movement is possible then moves Player
-
isEventInFront
private boolean isEventInFront(int x, int y, int directionSight)Checks if there is an Event cell in front of Player- Parameters:
x- X position of Playery- Y position of PlayerdirectionSight- direction of sight of Player- Returns:
- true if there is an event in front of Player
-
isDoorInFront
private boolean isDoorInFront(int x, int y, int directionSight)Checks if there is a Door cell in front of Player- Parameters:
x- X position of Playery- Y position of PlayerdirectionSight- direction of sight of Player- Returns:
- true if there is a door in front of Player
-
isChestInFront
private boolean isChestInFront(int x, int y, int directionSight)Checks if there is a Chest cell in front of Player- Parameters:
x- X position of Playery- Y position of PlayerdirectionSight- direction of sight of Player- Returns:
- true if there is a chest in front of Player
-
animateMove
public void animateMove(java.awt.Graphics2D g, int direction)Animates Players move throughout the map- Parameters:
g- graphics for paintingdirection- Player's movement direction
-
getIsMoving
public boolean getIsMoving()
-
setIsMoving
public void setIsMoving(boolean isMoving)
-
setDistance
public void setDistance(int distance)
-
getDistance
public int getDistance()
-
getDirectionMoveLast
public int getDirectionMoveLast()
-
setInEvent
public static void setInEvent(boolean isInEvent)
-
getDirectionSight
public int getDirectionSight()
-
isInEvent
public static boolean isInEvent()
-
-