class Log { float x, y, logwidth, logheight; boolean sawed = false; boolean is_tree = false; color logcolor; color strokecolor = logcolor; Log (float xpos, float ypos, float logw, float logh, boolean ist) { x = xpos; y = ypos; logwidth = logw; logheight = logh; is_tree = ist; //draw(); } void drawLog(int logtext) { if (sawed) { logcolor = color(128, 88, 60); } else { logcolor = color(133, 79, 51); } stroke(strokecolor); // Set stroke color for the log strokeWeight(1); // Set stroke weight for the log fill(logcolor); // Set fill color for the log rect(x, y, logwidth, logheight); // Draw the log as a rectangle text(logtext, x, y); strokeWeight(1); stroke(0); if(is_tree) { color bushes = color(107, 117, 48); fill(bushes); ellipse(x+logwidth/2, y+5, 170*0.3, 160*0.3); } } void logCollide(Ship ship) { if(sawed == false) { if(ship.newX+10 > x && ship.newX-10 < x + logwidth && ship.newY+10 > y && ship.newY-10 < y + logheight) { ship.colliding = true; } } } void draw() { drawLog(4); logCollide(ship_zero); } } // class Tree extends Log { // Tree (float x, float y, float logw, float logh, boolean hasC) { // super(x, y, logw, logh, hasC); // } // void draw() { // color treecolor = color(133, 79, 51); // // rectMode(CENTER); // drawLog(1); // } // }