unless $PRAGMA_ONCE
class Spriteset_Map
attr :viewport4
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport4.z = 200
# 生成元件地图
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names
@tilemap.autotiles = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
# 生成远景平面
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# 生成雾平面
@fog = Plane.new(@viewport1)
@fog.z = 3000
# 生成角色活动块
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events)
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
# 生成天气
@weather = RPG::Weather.new(@viewport1)
# 生成图片
@picture_sprites = []
for i in 1..49
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures))
end
@picture_sprites.push(Sprite_Picture.new(@viewport4,
$game_screen.pictures[50]))
# 生成计时器块
@timer_sprite = Sprite_Timer.new
# 刷新画面
update
end
alias dispose_old dispose if !method_defined? :dispose_old
def dispose
dispose_old
@viewport4.dispose
end
end
class Scene_Map
attr :spriteset
end
$PRAGMA_ONCE = 1
end
viewport = $scene.spriteset.viewport4
# 以下四个数分别是你想要部分显示图片的矩形的 x、y 坐标、宽度、高度
viewport.rect.set(100, 100, 100, 100)
# 原点 x 和原点 y 坐标
viewport.ox = 100
viewport.oy = 100
true
viewport = $scene.spriteset.viewport2
viewport.rect.set(0, 0, 640, 480)
viewport.ox = 0
viewport.oy = 0
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |