Class PowerUp

    • Constructor Summary

      Constructors 
      Constructor Description
      PowerUp​(com.badlogic.gdx.math.Vector2 newPosition)
      Constructor used to instantiate the class.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      com.badlogic.gdx.math.Vector2 getPosition()
      Returns the player's position.
      boolean isTaken()
      Returns if the player has picked up this PowerUp.
      boolean isUsed()
      Used to determine if the powerup has been used and is no longer affecting the player.
      boolean playerCollision​(float playerX, float playerY, float playerWidth, float playerHeight)
      Determines if the player is touching this powerup.
      void render​(com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer)
      Draws this powerup using the specified shapeRenderer.
      void setPosition​(com.badlogic.gdx.math.Vector2 newPosition)
      Sets the position of this PowerUp.
      void setRGB​(float newR, float newG, float newB)
      Sets the colour of this PowerUp.
      void setTaken​(boolean newTaken)
      Sets whether the player has picked up this PowerUp.
      void setUsed​(boolean newUsed)
      Returns whether the player has finished using this PowerUp.
      abstract void update​(Player player)
      An abstract method used to update the PowerUp every frame.
      • Methods inherited from class com.badlogic.gdx.graphics.g2d.Sprite

        draw, draw, flip, getBoundingRectangle, getColor, getHeight, getOriginX, getOriginY, getRotation, getScaleX, getScaleY, getVertices, getWidth, getX, getY, rotate, rotate90, scale, scroll, set, setAlpha, setBounds, setCenter, setCenterX, setCenterY, setColor, setColor, setFlip, setOrigin, setOriginBasedPosition, setOriginCenter, setPackedColor, setPosition, setRegion, setRotation, setScale, setScale, setSize, setU, setU2, setV, setV2, setX, setY, translate, translateX, translateY
      • Methods inherited from class com.badlogic.gdx.graphics.g2d.TextureRegion

        getRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, isFlipX, isFlipY, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, split, split
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PowerUp

        public PowerUp​(com.badlogic.gdx.math.Vector2 newPosition)
        Constructor used to instantiate the class.
        Parameters:
        newPosition - A Vector2 containing the position of the PowerUp.
    • Method Detail

      • update

        public abstract void update​(Player player)
        An abstract method used to update the PowerUp every frame.
        Parameters:
        player - The Player, used to update the PowerUp.
      • playerCollision

        public boolean playerCollision​(float playerX,
                                       float playerY,
                                       float playerWidth,
                                       float playerHeight)
        Determines if the player is touching this powerup.
        Parameters:
        playerX - The x-coordinate of the player.
        playerY - The y-coordinate of the player.
        playerWidth - The width of the player.
        playerHeight - The height of the player.
        Returns:
        True if the player is touching this, false otherwise
      • render

        public void render​(com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer)
        Draws this powerup using the specified shapeRenderer.
        Parameters:
        shapeRenderer - The ShapeRenderer used to draw the powerup.
      • isUsed

        public boolean isUsed()
        Used to determine if the powerup has been used and is no longer affecting the player.
        Returns:
        A boolean containing true if the powerup has been used and is no longer affecting the player, false otherwise.
      • setRGB

        public void setRGB​(float newR,
                           float newG,
                           float newB)
        Sets the colour of this PowerUp.
        Parameters:
        newR - The red component of the new colour.
        newG - The green component of the new colour.
        newB - The blue component of the new colour.
      • setTaken

        public void setTaken​(boolean newTaken)
        Sets whether the player has picked up this PowerUp.
        Parameters:
        newTaken - Whether the player has picked up this PowerUp or not.
      • isTaken

        public boolean isTaken()
        Returns if the player has picked up this PowerUp.
        Returns:
        A boolean containing True if the player picked up this PowerUp, false otherwise.
      • getPosition

        public com.badlogic.gdx.math.Vector2 getPosition()
        Returns the player's position.
        Returns:
        A Vector2 containing the player's position.
      • setUsed

        public void setUsed​(boolean newUsed)
        Returns whether the player has finished using this PowerUp.
        Parameters:
        newUsed - A boolean containing True if the player has finished using this PowerUp, false otherwise.
      • setPosition

        public void setPosition​(com.badlogic.gdx.math.Vector2 newPosition)
        Sets the position of this PowerUp.
        Parameters:
        newPosition - A Vector2 containing this PowerUp's new position.