public class Torso extends PigComponent {
public Torso(PVector initPos, PVector initSize, Sketch initP) {
super(initPos, initSize, initP);
// add Head
new Head(this);
// add Legs
// for (int i = 1; i <= 4; i++) {
// new Leg(this, i); // i for leg number (each leg has a position)
// }
}
@Override
public void drawComponent() {
p.stroke(this.strokeColor);
p.fill(this.fillColor);
p.strokeWeight(this.strokeWeight);
p.ellipse(pos.x, pos.y, size.x, size.y);
}
@Override
public void computeBoundingBox() {
topLeft = new PVector(pos.x - size.x/2 - strokeWeight/2, pos.y - size.y/2 - strokeWeight/2);
bottomRight = new PVector(pos.x + size.x/2 + strokeWeight/2, pos.y + size.y/2 + strokeWeight/2);
}
}
Put this code in your Torso.java
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.