class Map_Zoom
attr_accessor :rate
def initialize(rate)
@rate = rate
end
end
class Sprite_Character
alias zoom_initialize initialize
def initialize(viewport, character = nil)
zoom_initialize(viewport, character)
self.zoom_x = $map_zoom.rate
self.zoom_y = $map_zoom.rate
end
end
class Tilemap
alias zoom_initialize initialize
def initialize(viewport)
zoom_initialize(viewport)
for i in 0..2
@map[i].zoom_x = $map_zoom.rate
@map[i].zoom_y = $map_zoom.rate
end
end
end
class Game_Character
def screen_x
return (@real_x - $game_map.display_x) / (4.0 / $map_zoom.rate) + (16 * $map_zoom.rate)
end
def screen_y
y = (@real_y - $game_map.display_y + 3) / (4.0 / $map_zoom.rate) + (32 * $map_zoom.rate)
if @jump_count >= @jump_peak
n = @jump_count - @jump_peak
else
n = @jump_peak - @jump_count
end
return y - (@jump_peak * @jump_peak - n * n) / 2
end
def screen_z(height = 0)
if @always_on_top
return 999
end
z = (@real_y - $game_map.display_y + 3) / (4.0 / $map_zoom.rate) + (32 * $map_zoom.rate)
if @tile_id > 0
return z + $game_map.priorities[@tile_id] * 32
else
return z + ((height > 32) ? 31 : 0)
end
end
end
$map_zoom = Map_Zoom.new(0.5)