Class Ship

    • Field Detail

      • shipDirections

        public static com.badlogic.gdx.utils.ObjectMap<com.badlogic.gdx.math.Vector2,​java.lang.String> shipDirections
    • Constructor Detail

      • Ship

        public Ship()
        Creates a ship entity, containing Transform, Renderable, RigidBody, and Pirate components.
    • Method Detail

      • isAlive

        public boolean isAlive()
      • getAttackRange

        public static float getAttackRange()
      • plunder

        public void plunder​(int money)
      • setFaction

        public void setFaction​(int factionId)
        Associates ship with faction and orients it to the default northern direction.
        Parameters:
        factionId - the desired faction id
      • getFaction

        public int getFaction()
      • setShipDirection

        public void setShipDirection​(com.badlogic.gdx.math.Vector2 dir)
        Will rotate the ship to face the direction (just changes the sprite doesn't actually rotate)
        Parameters:
        dir - the dir to face (used to get the correct sprite from the texture atlas
      • setShipDirection

        public void setShipDirection​(java.lang.String direction)
        Will rotate the ship to face the direction (just changes the sprite doesn't actually rotate)
        Parameters:
        direction - the dir to face (used to get the correct sprite from the texture atlas
      • getHealth

        public int getHealth()
      • getPlunder

        public int getPlunder()
      • shoot

        public void shoot​(com.badlogic.gdx.math.Vector2 dir)
      • shoot

        public void shoot()
      • getPosition

        public com.badlogic.gdx.math.Vector2 getPosition()
        Returns:
        copy of the transform's position
      • setPosition

        public void setPosition​(float x,
                                float y)