I've made a new block of code that is meant to work as an addon for the previous one (which means: the code from before is still required, not to be replaced/deleted). This is for what I had mentioned earlier, implementing the flip mechanic right into the engine's base movement system, making overcomplicated handling through CEs unnecessary.
The script will always display every eventoid character (including player, vehicles and followers) on the map (except those with tile-graphic or "!" prefix which signal a static object) with the graphic for right-direction. If an event on the map is set to face left, it will still display right, but mirrored from the start.
It also should fix your issue with flipping while transfer, but I'm not fully sure about.
There still is a little problem about all of this that I'm not able to provide a solution for right now:
For example, when you walk upward and the player-graphic is facing right, and there is a character on the next tile to the right, you won't be able to talk to them until pressing right to make the player facing right. If that's okay for you, this should be useable by now.
Spoiler: THE CODE
Ruby:
#==============================================================================
# ** Paperflip Character Walking Graphic: Direct Bridge to Movement System
#------------------------------------------------------------------------------
# © 2024 KotatsuAkira / Akira Kotatsuhime
# Do not redistribute without copyright-notice intact.
#------------------------------------------------------------------------------
# This is an addon for "Paperflip Character Walking Graphic".
# The original script is required for this to actually work.
#------------------------------------------------------------------------------
# This script will make all eventoid objects that are NOT recognized as
# object-character (objects based on tile-content or files with "!" prefix)
# automatically flip when they turn left or right after facing the opposite.
# They will not be able to display any other graphic than right-face, left is
# displayed by mirroring, just like in THAT ONE well-known paper-game-series.
#------------------------------------------------------------------------------
# Events that are set to left by default are displayed with mirrored right
# graphic when entering map, any other direction displays right unmirrored.
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# * Get Facing Direction
#--------------------------------------------------------------------------
def face_direction
@face_direction ||= @mirrored_display ? 4 : 6
end
#--------------------------------------------------------------------------
# * Set Direction
#--------------------------------------------------------------------------
def set_direction(sd)
@stop_count = 0
return if sd.zero?
@direction = sd unless @direction_fix
return if object_character? || @direction_fix
if face_direction == 4 && sd == 6
flip(Graphics.frame_rate / 6)
elsif face_direction == 6 && sd == 4
flip(Graphics.frame_rate / 6)
end
@face_direction = sd if sd == 4 || sd == 6
end
#--------------------------------------------------------------------------
# * Clear Flipping Process
#--------------------------------------------------------------------------
def clear_flipping
return unless flipping?
mirror_display if @flipping_mirror && !@flipping_mirrored
reset_flip
end
#--------------------------------------------------------------------------
# * Straighten Character
#--------------------------------------------------------------------------
alias __original_straighten straighten unless $@
def straighten
clear_flipping
__original_straighten
end
end
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Setup Page Settings
#--------------------------------------------------------------------------
alias __original_setup_page_settings setup_page_settings unless $@
def setup_page_settings
__original_setup_page_settings
@mirrored_display = !object_character? && @direction == 4
end
end
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Perform Position/Map Transfer
#--------------------------------------------------------------------------
alias __original_perform_transfer perform_transfer unless $@
def perform_transfer
__original_perform_transfer
clear_flipping if transfer?
end
end
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Update Source Graphic Area
#--------------------------------------------------------------------------
def update_src_rect
if @tile_id == 0
si = @character.character_index
sp = @character.pattern < 3 ? @character.pattern : 1
sd = @character.object_character? ? @character.direction : 6
sx = (si % 4 * 3 + sp) * @cw
sy = (si / 4 * 4 + (sd - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end
~炬燵あ