Package struct

Class FrameData

java.lang.Object
struct.FrameData

public class FrameData extends Object
The class dealing with the information in the game such as the current frame number, number of rounds and character information.
  • Field Details

    • characterData

      private CharacterData[] characterData
      The character's data of both characters
      Index 0 is P1, index 1 is P2.
    • currentFrameNumber

      private int currentFrameNumber
      The current frame of the round.
    • currentRound

      private int currentRound
      The current round number.
    • projectileData

      private Deque<AttackData> projectileData
      The projectile data of both characters.
    • emptyFlag

      private boolean emptyFlag
      If this value is true, no data are available or they are dummy data.
    • front

      private boolean[] front
      The facing direction of both characters
  • Method Details

    • getCharacter

      public CharacterData getCharacter(boolean playerNumber)
      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, or false 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

      public Deque<AttackData> getProjectiles()
      Returns the projectile data of both characters.
      Returns:
      the projectile data of both characters
    • getProjectilesByP1

      public Deque<AttackData> getProjectilesByP1()
      Returns the projectile data of player 1.
      Returns:
      the projectile data of player 1
    • getProjectilesByP2

      public Deque<AttackData> 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, or false 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.