Change only one little thing of a method without rewrite it.

Hi,

I want to change the last line from def draw_character:

  def draw_character(character_name, character_index, x, y)    return unless character_name    bitmap = Cache.character(character_name)    sign = character_name[/^[\!\$]./]    if sign && sign.include?('$')      cw = bitmap.width / 3      ch = bitmap.height / 4    else      cw = bitmap.width / 12      ch = bitmap.height / 8    end    n = character_index    src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)    # Make the Pictures X and Y be the Mid of the Rect    contents.blt(x - cw / 2, y - ch, bitmap, src_rect)   endBut I dont want to copy the whole method into my class. My Class inherits from Window_MenuStatus.

Is there a possibility to alter only one line of an excisting method, or do I need to copy this method?

The problem is, that if I use this method to draw the character it use the mid of the x-cor as reference:  "x - cw / 2"

and I want the same with the y-cor. So that the reference of the bitmap is the whole mid.

So the last line would look like this: contents.blt(x - cw / 2, y - ch / 2, bitmap, src_rect)

I have made the extension bold.

Excuses for this english^^
You need to change the whole thing.
There are workarounds, but for the amount of code you would spend and the uncertainty of whether another script also made alterations, you would be better off just copying the method.
copy the whole method (and edit it), or edit the original...
Yeah I just copied,

Thanks for your answer.

Original thread: https://forums.rpgmakerweb.com/threads/change-only-one-little-thing-of-a-method-without-rewrite-it.18185/