mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixes wearable sprite offset and layering issues when autoscrolling the map
This commit is contained in:
@@ -2,7 +2,6 @@ class Sprite_Wearable < RPG::Sprite
|
||||
attr_accessor :filename
|
||||
attr_accessor :action
|
||||
attr_accessor :sprite
|
||||
attr_accessor :must_adjust_scroll
|
||||
|
||||
def initialize(player_sprite, filename, action, viewport)
|
||||
@player_sprite = player_sprite
|
||||
@@ -17,8 +16,6 @@ class Sprite_Wearable < RPG::Sprite
|
||||
@frameHeight = 80 #@sprite.height / 4
|
||||
@sprite.z = 0
|
||||
@relative_z=0 #relative to player
|
||||
@map_scrolled=false #true if the map has scrolled, false if centered on the player
|
||||
@must_adjust_scroll = false #todo temp fix for weird pokemart scrolling glitch
|
||||
echoln(_INTL("init had at z = {1}, player sprite at {2}",@sprite.z,@player_sprite.z))
|
||||
|
||||
#Unused position offset
|
||||
@@ -32,24 +29,24 @@ class Sprite_Wearable < RPG::Sprite
|
||||
end
|
||||
|
||||
def adjustPositionForScreenScrolling
|
||||
return if !$game_map.scrolling? && !(@map_scrolled && @must_adjust_scroll)
|
||||
if $game_player.isCentered()
|
||||
@map_scrolled=false
|
||||
return
|
||||
return if !$game_map.scrolling? && !@was_just_scrolling
|
||||
if $game_map.scrolling?
|
||||
@was_just_scrolling=true
|
||||
else
|
||||
@was_just_scrolling=false
|
||||
end
|
||||
@map_scrolled=true if @must_adjust_scroll
|
||||
offset_x = 0
|
||||
offset_y = 0
|
||||
@sprite.z+=10
|
||||
case $game_map.scroll_direction
|
||||
when DIRECTION_RIGHT
|
||||
offset_x=-8
|
||||
when DIRECTION_LEFT
|
||||
offset_x=8
|
||||
when DIRECTION_UP
|
||||
offset_y=16
|
||||
offset_y=8
|
||||
@sprite.z+=50 #weird layering glitch for some reason otherwise. It's reset to the correct value in the next animation frame
|
||||
when DIRECTION_DOWN
|
||||
offset_y=-16
|
||||
offset_y=-8
|
||||
end
|
||||
@sprite.x+=offset_x
|
||||
@sprite.y+=offset_y
|
||||
@@ -125,8 +122,8 @@ class Sprite_Wearable < RPG::Sprite
|
||||
current_frame = @player_sprite.character.pattern if !frame
|
||||
direction = @player_sprite.character.direction
|
||||
crop_spritesheet(direction)
|
||||
set_sprite_position(@action, direction, current_frame)
|
||||
adjust_layer()
|
||||
set_sprite_position(@action, direction, current_frame)
|
||||
end
|
||||
|
||||
def update(action, filename,color)
|
||||
|
||||
Reference in New Issue
Block a user