|
- #==============================================================================
- # ★ ExMap_AutoPlane
- #------------------------------------------------------------------------------
- # 设定云、雾等显示在特定地图的脚本素材。
- #==============================================================================
- # 地图设定。
- # 请按照 地图ID、文件名、横向回圈、纵向回圈、Z 坐标、
- # 不透明度(0 ~ 255)、合成方式 (0:通常 1:加算 2:減算)的顺序填写
- # 例如) 地图ID为、将图片「fog.png」半透明并且显示在一般图片下面
- # 向左5向下2的速度回圈,那么就填写 => [5, "fog", 5, -2, 50, 128, 0]
- EXMAP_ATPLN_MAPS = [
- [0, "", 0, 0, 50, 0, 0],
- [0, "", 0, 0, 50, 0, 0],
- ]
-
- # 设定文件目录。
- # 指定雾图形文件位置 (Graphic/xxx/)
- # 0:System 1:Parallaxes 2:Pictures 3:Animations
- EXMAP_ATPLN_FOLDER = 1
- #------------------------------------------------------------------------------
- class Game_Map
- alias _exmapln_setup setup
- alias _exmapln_update update
- alias _exmapln_set_display_pos set_display_pos
- alias _exmapln_scroll_down scroll_down
- alias _exmapln_scroll_left scroll_left
- alias _exmapln_scroll_right scroll_right
- alias _exmapln_scroll_up scroll_up
- #--------------------------------------------------------------------------
- # ○ 公開インスタンス変数 (追加定義)
- #--------------------------------------------------------------------------
- attr_reader :fog # フォグデータ
- #--------------------------------------------------------------------------
- # ○ セットアップ (追加定義)
- # map_id : マップ ID
- #--------------------------------------------------------------------------
- def setup(map_id)
- _exmapln_setup(map_id)
- setup_fog
- end
- #--------------------------------------------------------------------------
- # ☆ フォグのセットアップ
- #--------------------------------------------------------------------------
- def setup_fog
- @fog = [0, "", 0, 0, 50, 0, 0]
- @fog_sx = 0
- @fog_sy = 0
- @fog_x = 0
- @fog_y = 0
- for data in EXMAP_ATPLN_MAPS
- if @map_id == data[0]
- @fog = data
- @fog_sx = data[2]
- @fog_sy = data[3]
- break
- end
- end
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新 (追加定義)
- #--------------------------------------------------------------------------
- def update
- _exmapln_update
- update_fog
- end
- #--------------------------------------------------------------------------
- # ○ 表示位置の設定 (追加定義)
- # x : 新しい表示 X 座標 (*256)
- # y : 新しい表示 Y 座標 (*256)
- #--------------------------------------------------------------------------
- def set_display_pos(x, y)
- _exmapln_set_display_pos(x, y)
- @fog_x = x
- @fog_y = y
- end
- #--------------------------------------------------------------------------
- # ☆ フォグ表示 X 座標の計算
- # bitmap : フォグビットマップ
- #--------------------------------------------------------------------------
- def calc_fog_x(bitmap)
- return bitmap == nil ? 0 : @fog_x / 8
- end
- #--------------------------------------------------------------------------
- # ☆ フォグ表示 Y 座標の計算
- # bitmap : フォグビットマップ
- #--------------------------------------------------------------------------
- def calc_fog_y(bitmap)
- return bitmap == nil ? 0 : @fog_y / 8
- end
- #--------------------------------------------------------------------------
- # ○ 下にスクロール (追加定義)
- # distance : スクロールする距離
- #--------------------------------------------------------------------------
- def scroll_down(distance)
- last_y = @display_y
- _exmapln_scroll_down(distance)
- if loop_vertical?
- @fog_y += distance
- else
- @fog_y += @display_y - last_y
- end
- end
- #--------------------------------------------------------------------------
- # ○ 左にスクロール (追加定義)
- # distance : スクロールする距離
- #--------------------------------------------------------------------------
- def scroll_left(distance)
- last_x = @display_x
- _exmapln_scroll_left(distance)
- if loop_horizontal?
- @fog_x -= distance
- else
- @fog_x += @display_x - last_x
- end
- end
- #--------------------------------------------------------------------------
- # ○ 右にスクロール (追加定義)
- # distance : スクロールする距離
- #--------------------------------------------------------------------------
- def scroll_right(distance)
- last_x = @display_x
- _exmapln_scroll_right(distance)
- if loop_horizontal?
- @fog_x += distance
- else
- @fog_x += @display_x - last_x
- end
- end
- #--------------------------------------------------------------------------
- # ○ 上にスクロール (追加定義)
- # distance : スクロールする距離
- #--------------------------------------------------------------------------
- def scroll_up(distance)
- last_y = @display_y
- _exmapln_scroll_up(distance)
- if @fog != nil
- if loop_vertical?
- @fog_y -= distance
- else
- @fog_y += @display_y - last_y
- end
- end
- end
- #--------------------------------------------------------------------------
- # ☆ フォグの更新
- #--------------------------------------------------------------------------
- def update_fog
- @fog_x += @fog_sx * 2
- @fog_y += @fog_sy * 2
- end
- end
- class Spriteset_Map
- alias _exmapln_initialize initialize
- alias _exmapln_dispose dispose
- alias _exmapln_update update
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化 (追加定義)
- #--------------------------------------------------------------------------
- def initialize
- create_fog
- _exmapln_initialize
- end
- #--------------------------------------------------------------------------
- # ☆ フォグの作成
- #--------------------------------------------------------------------------
- def create_fog
- @fog = Plane.new
- if $game_map.fog != nil
- @fog.z = $game_map.fog[4]
- @fog.opacity = $game_map.fog[5]
- @fog.blend_type = $game_map.fog[6]
- end
- end
- #--------------------------------------------------------------------------
- # ○ 解放 (追加定義)
- #--------------------------------------------------------------------------
- def dispose
- _exmapln_dispose
- @fog.dispose
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新 (追加定義)
- #--------------------------------------------------------------------------
- def update
- _exmapln_update
- update_fog
- end
- #--------------------------------------------------------------------------
- # ☆ フォグの更新
- #--------------------------------------------------------------------------
- def update_fog
- if @fog_name != $game_map.fog[1]
- @fog_name = $game_map.fog[1]
- if @fog.bitmap != nil
- @fog.bitmap.dispose
- @fog.bitmap = nil
- end
- if @fog_name != ""
- case EXMAP_ATPLN_FOLDER
- when 0
- @fog.bitmap = Cache.system(@fog_name)
- when 1
- @fog.bitmap = Cache.parallax(@fog_name)
- when 2
- @fog.bitmap = Cache.picture(@fog_name)
- when 3
- @fog.bitmap = Cache.animation(@fog_name, 0)
- end
- end
- Graphics.frame_reset
- end
- @fog.ox = $game_map.calc_fog_x(@fog.bitmap)
- @fog.oy = $game_map.calc_fog_y(@fog.bitmap)
- end
- end
复制代码- #==============================================================================
- # ★ ExBattle_Background
- #------------------------------------------------------------------------------
- # 使战斗画面能设定任意背景的脚本素材。
- #==============================================================================
- # 地图设定。
- # 请按照 地图 ID、图片名 的顺序填写。
- EXBTL_BACKGR_MAP = {
- 1 => "Ocean",
- 2 => "Mountains",
- }
- # 区域设定。
- # 请按照 区域 ID、图片名 的顺序填写。
- EXBTL_BACKGR_AREA = {
- 1 => "Sunset",
- 2 => "CloudySky",
- }
- # 显示位置。
- # 指定图片的显示位置 (0:上 1:中 2:下) 。
- EXBTL_BACKGR_POSITION = 1
- # 设定战斗地面
- # 设定战斗地面是否显示。
- # (0:不显示 1:显示)
- EXBTL_BACKGR_FLOOR = 0
- # 设定文件目录。
- # 指定战斗背景图片文件位置 (Graphic/xxx/) 。
- # 0:System 1:Parallaxes 2:Pictures
- EXBTL_BACKGR_FOLDER = 1
- #------------------------------------------------------------------------------
- class Spriteset_Battle
- alias _exbbackgr_create_battleback create_battleback
- alias _exbbackgr_create_battlefloor create_battlefloor
- #--------------------------------------------------------------------------
- # ○ 建立战斗背景精灵 (附加定义)
- #--------------------------------------------------------------------------
- def create_battleback
- fixed = false
- for area in $data_areas.values
- if $game_player.in_area?(area) and EXBTL_BACKGR_AREA.has_key?(area.id)
- source = EXBTL_BACKGR_AREA[area.id]
- fixed = true
- end
- end
- unless fixed
- if EXBTL_BACKGR_MAP.has_key?($game_map.map_id)
- source = EXBTL_BACKGR_MAP[$game_map.map_id]
- fixed = true
- end
- end
- if fixed
- case EXBTL_BACKGR_FOLDER
- when 0
- bitmap = Cache.system(source)
- when 1
- bitmap = Cache.parallax(source)
- when 2
- bitmap = Cache.picture(source)
- end
- @battleback_sprite = Sprite.new(@viewport1)
- @battleback_sprite.bitmap = bitmap
- @battleback_sprite.x = (544 - bitmap.width) / 2
- case EXBTL_BACKGR_POSITION
- when 0
- @battleback_sprite.y = 0
- when 1
- @battleback_sprite.y = (416 - bitmap.height) / 2
- when 2
- @battleback_sprite.y = 416 - bitmap.height
- end
- else
- _exbbackgr_create_battleback
- end
- end
- #--------------------------------------------------------------------------
- # ○ 建立战斗背景精灵 (附加定义)
- #--------------------------------------------------------------------------
- def create_battlefloor
- _exbbackgr_create_battlefloor
- @battlefloor_sprite.opacity = 0 if EXBTL_BACKGR_FLOOR == 0
- end
- end
复制代码 |
|