#============================================================================== # ★ ピクチャ用変数 ver1.0 by USK #------------------------------------------------------------------------------ # ・特定のピクチャの縦横倍率、不透明度、角度と変数を紐つけます # ・画像の指定した領域だけ表示が可能になります #============================================================================== =begin ・PictureValueListの↑と↓の間の行に、例のように "(ピクチャファイル名)"=>{ :z_x=>(横方向倍率を設定する変数の番号), :z_y=>(縦方向倍率を設定する変数の番号), :op =>(不透明度を設定する変数の番号), :an=>(回転角度を設定する変数の番号), :src=>[ (ピクチャ表示領域右上x座標を設定する変数の番号), (ピクチャ表示領域右上y座標を設定する変数の番号), (ピクチャ表示領域の横幅を設定する変数の番号), (ピクチャ表示領域の縦幅を設定する変数の番号) ] }, を設定すると指定した変数の中の値が指定したファイル名のピクチャに影響します ・「変数番号」と「変数の値」を混同しないようにしてください ・各行の最後に半角コンマ(,)を忘れないでください ・変数の値はでフォルトが0なので値を設定しないと倍率0不透明度0で表示されません ・横方向倍率、縦方向倍率は150で1.5倍のように百分率の値 ・不透明度は0〜255の値 ・回転角度は0〜360の値 ・(ピクチャ表示領域右上x座標+ピクチャ表示領域の横幅)はピクチャの横幅以下 ・(ピクチャ表示領域右上y座標+ピクチャ表示領域の縦幅)はピクチャの横幅以下 =end PictureValueList = { "Angel"=>{:z_x=>10,:z_y=>11,:op =>12,:an=>13,:src=>[14,15,16,17]},#例 #↓ #↑ } #============================================================================== # ■ Game_Variables #============================================================================== class Game_Variables #-------------------------------------------------------------------------- # ● 変数の設定時の処理 #-------------------------------------------------------------------------- alias :usk_pv_on_change :on_change def on_change usk_pv_on_change if SceneManager.scene_is?(Scene_Map) $game_map.screen.update_pictures elsif SceneManager.scene_is?(Scene_Battle) $game_troop.screen.update_pictures end end end #============================================================================== # ■ Game_Picture #============================================================================== class Game_Picture attr_reader :src #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- alias :usk_pv_update :update def update usk_pv_update update_value end #-------------------------------------------------------------------------- # ● ピクチャの表示 #-------------------------------------------------------------------------- alias :usk_pv_show :show def show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type) usk_pv_show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type) @value = PictureValueList[@name] update_value end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def value(sym) $game_variables[@value[sym]||0] end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def update_value return if @value.nil? @zoom_x = value(:z_x) if value(:z_x) > 0 @zoom_y = value(:z_y) if value(:z_y) > 0 @opacity = value(:op) if value(:op).between?(0, 255) @angle = value(:an) v = @value[:src] x = $game_variables[v[0]] y = $game_variables[v[1]] w = $game_variables[v[2]] h = $game_variables[v[3]] @src = w == 0 || h == 0 ? nil : Rect.new(x, y, w, h) end end #============================================================================== # ■ Sprite_Picture #============================================================================== class Sprite_Picture #-------------------------------------------------------------------------- # ● 転送元ビットマップの更新 #-------------------------------------------------------------------------- alias :usk_pv_update_bitmap :update_bitmap def update_bitmap usk_pv_update_bitmap self.src_rect = @picture.src || self.src_rect if @picture.src && ox > 0 self.ox = width >> 1 self.oy = height >> 1 end end #-------------------------------------------------------------------------- # ● 原点の更新 #-------------------------------------------------------------------------- alias :usk_pv_update_origin :update_origin def update_origin usk_pv_update_origin if @picture.src && ox > 0 self.ox = width >> 1 self.oy = height >> 1 end end end