Package struct
Class FrameData
java.lang.Object
struct.FrameData
The class dealing with the information in the game such as the current frame
number, number of rounds and character information.
-
Field Summary
Modifier and TypeFieldDescriptionprivate CharacterData[]
The character's data of both characters
Index 0 is P1, index 1 is P2.private int
The current frame of the round.private int
The current round number.private boolean
If this value is true, no data are available or they are dummy data.private boolean[]
The facing direction of both charactersprivate Deque<AttackData>
The projectile data of both characters. -
Method Summary
Modifier and TypeMethodDescriptiongetCharacter
(boolean playerNumber) Returns an instance of the CharacterData class of the player specified by an argument.int
Returns the horizontal distance between P1 and P2.int
Returns the vertical distance between P1 and P2.boolean
Returns true if this instance is empty, false if it contains meaningful data.int
Returns the number of frames since the beginning of the round.Returns the projectile data of both characters.Returns the projectile data of player 1.Returns the projectile data of player 2.int
getRound()
Returns the current round number.boolean
isFront
(boolean player) The character's facing direction.
-
Field Details
-
characterData
The character's data of both characters
Index 0 is P1, index 1 is P2. -
currentFrameNumber
private int currentFrameNumberThe current frame of the round. -
currentRound
private int currentRoundThe current round number. -
projectileData
The projectile data of both characters. -
emptyFlag
private boolean emptyFlagIf this value is true, no data are available or they are dummy data. -
front
private boolean[] frontThe facing direction of both characters
-
-
Method Details
-
getCharacter
Returns an instance of the CharacterData class of the player specified by an argument.- Parameters:
playerNumber
- the number of the player.true
if the player is P1, orfalse
if P2.- Returns:
- an instance of the CharacterData class of the player
-
getFramesNumber
public int getFramesNumber()Returns the number of frames since the beginning of the round.- Returns:
- the number of frames since the beginning of the round
-
getRound
public int getRound()Returns the current round number.- Returns:
- the current round number
-
getProjectiles
Returns the projectile data of both characters.- Returns:
- the projectile data of both characters
-
getProjectilesByP1
Returns the projectile data of player 1.- Returns:
- the projectile data of player 1
-
getProjectilesByP2
Returns the projectile data of player 2.- Returns:
- the projectile data of player 2
-
getEmptyFlag
public boolean getEmptyFlag()Returns true if this instance is empty, false if it contains meaningful data.- Returns:
true
if this instance is empty, orfalse
if it contains meaningful data
-
getDistanceX
public int getDistanceX()Returns the horizontal distance between P1 and P2.- Returns:
- the horizontal distance between P1 and P2
-
getDistanceY
public int getDistanceY()Returns the vertical distance between P1 and P2.- Returns:
- the vertical distance between P1 and P2
-
isFront
public boolean isFront(boolean player) The character's facing direction.- Parameters:
player
- The character's side flag- Returns:
true
if the character is facing right,false
otherwise.
-