Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Block{
- private int xPos; //x position of the block
- private int yPos; //y position of the block
- private int blockWidth; //width of the block
- private int blockHeight; //height of the block
- private color blockColor; //color of the block
- public Block(){
- …
- }
- //add other Block constructors
- //mutators, add others
- public void setPos(int x, int y){…}
- public void setX(int x){…}
- public void setY(int y){…}
- public void display(){
- fill(blockColor);
- rect(xPos, yPos, blockWidth, blockHeight);
- }
- public void display(color col){
- fill(col);
- rect(xPos, yPos, blockWidth, blockHeight);
- }
- public boolean equals(Object other){
- …
- }
- public String toString(){…}//hint: the function red(blockColor) will give the amount of red in blockColor
- //accessors, add others
- public int getX(){…}
- public int getY(){…}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement