I need to use inheritance for a project of mine. Currently, I Have been looking at this example code to create a person.
class Human implements Drawable{
int armAngle = 0;
int angleChange = 5;
final int ANGLE_LIMIT = 135;
void draw()
{
noStroke();
fill(38, 38, 200);
ellipse(73+x, 225+y, 40, 40); // head
rect(50+x, 250+y, 50, 60); // body
drawLeftArm();
drawRightArm();
rect(60+x, 300+y, 16, 50); // left leg
rect(80+x, 300+y, 15, 50); // right leg
fill(222, 222, 249);
ellipse(80+x, 220+y, 8, 8); // left eye
ellipse(65+x, 220+y, 8, 8); // right eye
}
void drawLeftArm()
{
pushMatrix();
translate(12, 32);
rotate(radians(armAngle));
rect(25+x, 220+y, 10, 45); // left arm
popMatrix();
}
void drawRightArm()
{
pushMatrix();
translate(66, 32);
rotate(radians(-armAngle));
rect(37+x, 220+y, 10, 45); // right arm
popMatrix();
}
In my Child class, I have this
class Child extends Human{
void draw(){
super.draw();
}
}
Obviously my problem is my child class is just drawing an exact copy on top of my Human class but I can not figure out how to alter the child class without just copy pasting the code over again making the inheritence pointless. Ideally I would like to make the child smaller and beside the Human parent class. How would i go about this?