Class ObstacleControl


  • public class ObstacleControl
    extends Component
    // Added for Assessment 2 Requirements // Makes an Entity act as an Obstacle to the Player, causing damage upon collision in a variety of differing ways.
    • Constructor Detail

      • ObstacleControl

        public ObstacleControl​(float damage,
                               float hitRate,
                               int hitLimit)
        Generate an obstacle controller component.
        Parameters:
        damage - The damage that the obstacle does per 'hit'
        hitRate - The rate at which 'hits' occur while colliding
        hitLimit - The number of 'hits' required to break the obstacle
    • Method Detail

      • TryHit

        public void TryHit​(CollisionInfo collision,
                           boolean enter)
        Attempts to perform a collision action
        Parameters:
        collision - the collision info to be attempted
        enter - boolean that determines whether the collision is allowed