Modifing functions in classes using extends

i am making a game and am using nested classes to create block variations, but i want tree to have an addition to the drawing process (a progress bar). is there a way to use the same function call but have it run like normal and then draw a rectangle.

class tile{
  int x,y;String sprite;
  tile(int ix,int iy,String is){x=ix;y=iy;sprite=is;}
  void render(){
    drawSprite(sprite,x*32,y*32);
    text(x,x*32,y*32);
  }
}
class grass extends tile{
  grass(int ix,int iy){super(ix,iy,"image1");}
  
}class tree extends tile{
  tree(int ix,int iy){super(ix,iy,"image0");}
  void render(){
    //runTileRender
    fill(255,255,0);
    rect(x,y+32,32,-4);
  }
}
1 Like

I figured it out, its

super.render();
2 Likes

Great!

Another option if things get more complex later is composition, using implements. Then some things can be Renderable and some things can be Progressable.