Class Platform


public class Platform extends Sprite
Platform class Can be used with the following tutorials: https://longbaonguyen.github.io/courses/platformer/platformer.html
  • Constructor Details

    • Platform

      public Platform(processing.core.PApplet p, processing.core.PImage img, float posXCenter, float posYTop, float platWidth, float platHeight)
      Platform Constructor #1: Platform is PImage defined by it's center-x and top-Y positions
      Parameters:
      p - Processing applet
      img - PImage to be displayed on the Platform
      posXCenter - x-pixel-value of the center of the Platform
      posYTop - y-pixel-value of the top of the Platform
      platWidth - width in pixels of the Platform
      platHeight - height in pixels of the Platform
    • Platform

      public Platform(processing.core.PApplet p, int color, float posXCenter, float posYTop, float platWidth, float platHeight)
      Platform Constructor #2: Platform is a rectangle of color defined by it's center-x and top-Y positions
      Parameters:
      p - Processing applet
      color - PColor int for the color of the Platform
      posXCenter - x-pixel-value of the center of the Platform
      posYTop - y-pixel-value of the top of the Platform
      platWidth - width in pixels of the Platform
      platHeight - height in pixels of the Platform
  • Method Details

    • setColor

      public void setColor(int color)
      Mutator method
      Parameters:
      color - PColor int for the color of the inside of the rectangle
    • getColor

      public int getColor()
      Accessor method
      Returns:
      int color of the inside of the rectangle as a PColor
    • setOutlineColor

      public void setOutlineColor(int outlineColor)
      Mutator method
      Parameters:
      outlineColor - PColor int for the color of the outline of the rectangle
    • getOutlineColor

      public int getOutlineColor()
      Accessor method
      Returns:
      int color of the outline of the rectangle as a PColor
    • show

      public void show()
      Displays the Platform on the Screen
      Overrides:
      show in class Sprite
    • toString

      public String toString()
      Overrides:
      toString in class Sprite
      Returns:
      String includes Sprite's toString() + the left, top, width, and height