Class Platform
java.lang.Object
Sprite
Platform
Platform class
Can be used with the following tutorials:
https://longbaonguyen.github.io/courses/platformer/platformer.html
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPlatform
(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 positionsPlatform
(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 -
Method Summary
Modifier and TypeMethodDescriptionint
getColor()
Accessor methodint
Accessor methodvoid
setColor
(int color) Mutator methodvoid
setOutlineColor
(int outlineColor) Mutator methodvoid
show()
Displays the Platform on the ScreentoString()
Methods inherited from class Sprite
copy, copyTo, doesCollideBottom, equals, getAccelerationX, getAccelerationY, getCenterX, getCenterY, getH, getImage, getImagePath, getIsAnimated, getName, getSpeedX, getSpeedY, getW, getX, getY, isOverlapping, isSolid, isTouchingBottom, isTouchingBottom, isTouchingLeft, isTouchingLeft, isTouchingRight, isTouchingRight, isTouchingTop, isTouchingTop, jump, jump, jump, move, moveTo, resize, rotate, setAccelerationX, setAccelerationY, setCenterX, setCenterY, setH, setImage, setIsAnimated, setName, setSolid, setSpeed, setSpeedX, setSpeedY, setW, startGravity, startGravity, stopGravity, update, update
-
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 appletimg
- PImage to be displayed on the PlatformposXCenter
- x-pixel-value of the center of the PlatformposYTop
- y-pixel-value of the top of the PlatformplatWidth
- width in pixels of the PlatformplatHeight
- 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 appletcolor
- PColor int for the color of the PlatformposXCenter
- x-pixel-value of the center of the PlatformposYTop
- y-pixel-value of the top of the PlatformplatWidth
- width in pixels of the PlatformplatHeight
- 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 -
toString
-