Problem of cut out Player's character sprite

I want to cut out few pixel of game_player's character sprite,where around feet.
Cutting will occur temporarily when a variable > 0 and reback to normal when the same variable == 0

How to do that?
You reduce the sprite's source rectangle's height first and then increase it after the time is over.
Wouldn't it be easier to just have a second version of the sprite, and when the variable is turned on/off, use a Change Actor Sprite command?
You reduce the sprite's source rectangle's height first and then increase it after the time is over.
Ruby:
def update_src_rect
  if @tile_id == 0
    index = @character.character_index
    pattern = @character.pattern < 3 ? @character.pattern : 1
    sx = (index % 4 * 3 + pattern) * @cw
    sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    @ch = 36 if @character.is_a?(Game_Player) && $game_variables[777] > 0          #I add this line
    @ch = 42 if @character.is_a?(Game_Player) && $game_variables[777] == 0          #And this line
    self.src_rect.set(sx, sy, @cw, @ch)
  end
end

Character Sprite:
$Red.png

Size is 90x168
@ch = 168 / 4 = 42
After cut out 8 pixel,It should be 36


Result...
未命名.png

It's correct when the direction is "down" only

I don't know what should i do...
in your example, you didn't cut the height of the sprite - you moved the reference point of the sprite instead while retaining the full height. That is why the missing parts of the height are filled from the cell above the one where you moved the reference point.

cutting height is a bit more difficult than just changing a few numbers, but unfortunately I don't know enough of the Ace scripts to tell you where and what to do instead.
Correct Answer~
Ruby:
def update_src_rect
  if @tile_id == 0
    index = @character.character_index
    pattern = @character.pattern < 3 ? @character.pattern : 1
    sx = (index % 4 * 3 + pattern) * @cw
    sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    if @character.is_a?(Game_Player) && $game_variables[777] > 0
        self.src_rect.set(sx, sy, @cw, @ch - 6)
    else
        self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
end

-End This Post-
If you want a thread closed, report your first post and let the mods know your question is answered.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/problem-of-cut-out-players-character-sprite.124996/