diff --git a/Data/Scripts/001_Technical/006_RPG_Sprite.rb b/Data/Scripts/001_Technical/006_RPG_Sprite.rb index 200f25b4fa..047b934531 100644 --- a/Data/Scripts/001_Technical/006_RPG_Sprite.rb +++ b/Data/Scripts/001_Technical/006_RPG_Sprite.rb @@ -340,32 +340,20 @@ def update end #=============================================================================== -# A modification to class Sprite that allows its coordinates to be floats rather -# than integers. +# A version of class Sprite that allows its coordinates to be floats rather than +# integers. #=============================================================================== -class Sprite - attr_accessor :float - - alias :__float__x :x - alias :__float__y :y - alias :__float__x_equals :x= - alias :__float__y_equals :y= - - def x - return (@float) ? @real_x : __float__x - end - - def y - return (@float) ? @real_y : __float__y - end +class FloatSprite < Sprite + def x; return @float_x; end + def y; return @float_y; end def x=(value) - @real_x = value if @float - __float__x_equals(value) + @float_x = value + super end def y=(value) - @real_y = value if @float - __float__y_equals(value) + @float_y = value + super end end diff --git a/Data/Scripts/012_Overworld/001_Overworld visuals/001_Overworld_Weather.rb b/Data/Scripts/012_Overworld/001_Overworld visuals/001_Overworld_Weather.rb index d7337c96a2..a68fe1807d 100644 --- a/Data/Scripts/012_Overworld/001_Overworld visuals/001_Overworld_Weather.rb +++ b/Data/Scripts/012_Overworld/001_Overworld visuals/001_Overworld_Weather.rb @@ -164,8 +164,7 @@ def ensureSprites if @sprites.length < MAX_SPRITES && @weatherTypes[@type] && @weatherTypes[@type][1].length > 0 MAX_SPRITES.times do |i| if !@sprites[i] - sprite = Sprite.new(@origViewport) - sprite.float = true + sprite = FloatSprite.new(@origViewport) sprite.z = 1000 sprite.ox = @ox + @ox_offset sprite.oy = @oy + @oy_offset @@ -180,8 +179,7 @@ def ensureSprites @weatherTypes[@target_type][1].length > 0 MAX_SPRITES.times do |i| if !@new_sprites[i] - sprite = Sprite.new(@origViewport) - sprite.float = true + sprite = FloatSprite.new(@origViewport) sprite.z = 1000 sprite.ox = @ox + @ox_offset sprite.oy = @oy + @oy_offset @@ -198,8 +196,7 @@ def ensureTiles return if @tiles.length >= @tiles_wide * @tiles_tall (@tiles_wide * @tiles_tall).times do |i| if !@tiles[i] - sprite = Sprite.new(@origViewport) - sprite.float = true + sprite = FloatSprite.new(@origViewport) sprite.z = 1000 sprite.ox = @ox + @ox_offset sprite.oy = @oy + @oy_offset