查看: 75|回复: 0

[转载发布] 【脚本】显示人物立绘

[复制链接]
  • TA的每日心情
    开心
    4 天前
  • 签到天数: 37 天

    连续签到: 3 天

    [LV.5]常住居民I

    2028

    主题

    32

    回帖

    7260

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    0
    卡币
    5184
    OK点
    16
    积分
    7260
    发表于 同元一千年八月七日(秋) | 显示全部楼层 |阅读模式
    自己编的一套显示人物立绘的脚本,立绘是新建的viewport,附截图与范例。
    截图:
    样式1:
    样式2:
    范例:
    代码:
    RUBY 代码
    1. #============================================================================
    2. =begin
    3.     编制人 wolves 发布位置 rpg.blue
    4.     显示人物立绘脚本,将下列脚本写在显示文章事件前即可显示立绘
    5.     $text_menu=[[name1(,left_fix1,top_fix1)],[name2(,left_fix2,top_fix2)],
    6.       [zoom_x,zoom_y](,type)]
    7.     其中括号部分可以省略
    8.     name1为 "" 则只显示右边的立绘,对话框左移;
    9.     name2为 "" 则只显示左边的立绘,对话框右移;
    10.     name1与name2均不为 "" 的情况下对话框居中剪短,两边一同显示立绘。
    11.     name1为 立绘1 的文件名(picture文件夹下)
    12.     如果觉得立绘位置不满意,可以通过left_fix1、top_fix1来修改图片位置。
    13.     比如想要只有左面的立绘 "1.png" ,并且根据原来的位置向上移动10像素,
    14. 向左移动12像素,不缩放:
    15.     $text_menu=[["1.png",-12,-10],[""],[100,100]]#然后后面紧跟显示文章
    16.     如果想要对图片进行缩放的话,可以修改zoom_x,zoom_y,立绘缩放是统一缩
    17. 放大小的,如果希望分别改大小的话,修改图片吧,或者参考359~365行内容
    18.     如果想要改变成没有左右边的形式的窗口,就把type设置成1吧(type可以缺省)
    19. =end
    20. #============================================================================
    21. class Game_Character_Picture
    22.   #--------------------------------------------------------------------------
    23.   # ● 定义实例变量
    24.   #--------------------------------------------------------------------------
    25.   attr_reader   :number                   # 图片编号
    26.   attr_reader   :name                     # 文件名
    27.   attr_reader   :origin                   # 原点
    28.   attr_reader   :x                        # X 坐标
    29.   attr_reader   :y                        # Y 坐标
    30.   attr_reader   :zoom_x                   # X 方向放大率
    31.   attr_reader   :zoom_y                   # Y 方向放大率
    32.   attr_reader   :opacity                  # 不透明度
    33.   attr_reader   :blend_type               # 合成方式
    34.   attr_reader   :tone                     # 色调
    35.   attr_reader   :angle                    # 旋转角度
    36.   #--------------------------------------------------------------------------
    37.   # ● 初始化对像
    38.   #     number : 图片编号
    39.   #--------------------------------------------------------------------------
    40.   def initialize(number)
    41.     @number = number
    42.     @name = ""
    43.     @origin = 0
    44.     @x = 0.0
    45.     @y = 0.0
    46.     @zoom_x = 100.0
    47.     @zoom_y = 100.0
    48.     @opacity = 255.0
    49.     @blend_type = 1
    50.     @duration = 0
    51.     @target_x = @x
    52.     @target_y = @y
    53.     @target_zoom_x = @zoom_x
    54.     @target_zoom_y = @zoom_y
    55.     @target_opacity = @opacity
    56.     @tone = Tone.new(0, 0, 0, 0)
    57.     @tone_target = Tone.new(0, 0, 0, 0)
    58.     @tone_duration = 0
    59.     @angle = 0
    60.     @rotate_speed = 0
    61.   end
    62.   #--------------------------------------------------------------------------
    63.   # ● 显示图片
    64.   #     name         : 文件名
    65.   #     origin       : 原点
    66.   #     x            : X 坐标
    67.   #     y            : Y 坐标
    68.   #     zoom_x       : X 方向放大率
    69.   #     zoom_y       : Y 方向放大率
    70.   #     opacity      : 不透明度
    71.   #     blend_type   : 合成方式
    72.   #--------------------------------------------------------------------------
    73.   def show(name, x, y, zoom_x, zoom_y, left_fix, top_fix)
    74.     @name = name
    75.     @origin = 0
    76.     left_fix = 0if left_fix.nil?
    77.     top_fix = 0if top_fix.nil?
    78.     @x = left_fix + x.to_f
    79.     @y = top_fix + y.to_f
    80.     @zoom_x = zoom_x.to_f
    81.     @zoom_y = zoom_y.to_f
    82.     @opacity = 255.0
    83.     @blend_type = 0
    84.     @duration = 0
    85.     @target_x = @x
    86.     @target_y = @y
    87.     @target_zoom_x = @zoom_x
    88.     @target_zoom_y = @zoom_y
    89.     @target_opacity = @opacity
    90.     @tone = Tone.new(0, 0, 0, 0)
    91.     @tone_target = Tone.new(0, 0, 0, 0)
    92.     @tone_duration = 0
    93.     @angle = 0
    94.     @rotate_speed = 0
    95.   end
    96.   #--------------------------------------------------------------------------
    97.   # ● 开始更改色调
    98.   #     tone     : 色调
    99.   #     duration : 时间
    100.   #--------------------------------------------------------------------------
    101.   def start_tone_change(tone, duration)
    102.     @tone_target = tone.clone
    103.     @tone_duration = duration
    104.     if@tone_duration == 0
    105.       @tone = @tone_target.clone
    106.     end
    107.   end
    108.   #--------------------------------------------------------------------------
    109.   # ● 消除图片
    110.   #--------------------------------------------------------------------------
    111.   def erase
    112.     @name = ""
    113.   end
    114.   #--------------------------------------------------------------------------
    115.   # ● 刷新画面
    116.   #--------------------------------------------------------------------------
    117.   def update
    118.     if@duration >= 1
    119.       d = @duration
    120.       @x = (@x * (d - 1) + @target_x) / d
    121.       @y = (@y * (d - 1) + @target_y) / d
    122.       @zoom_x = (@zoom_x * (d - 1) + @target_zoom_x) / d
    123.       @zoom_y = (@zoom_y * (d - 1) + @target_zoom_y) / d
    124.       @opacity = (@opacity * (d - 1) + @target_opacity) / d
    125.       @duration -= 1
    126.     end
    127.     if@tone_duration >= 1
    128.       d = @tone_duration
    129.       @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
    130.       @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
    131.       @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
    132.       @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
    133.       @tone_duration -= 1
    134.     end
    135.     if@rotate_speed != 0
    136.       @angle += @rotate_speed / 2.0
    137.       while@angle < 0
    138.         @angle += 360
    139.       end
    140.       @angle %= 360
    141.     end
    142.   end
    143. end
    144. class Window_Message
    145.   def initialize
    146.     super(80, 304, 480, 160)
    147.     self.contents = Bitmap.new(width - 32, height - 32)
    148.     self.visible = false
    149.     self.z = 9997
    150.     @fade_in = false
    151.     @fade_out = false
    152.     @contents_showing = false
    153.     @cursor_width = 0
    154.     self.active = false
    155.     self.index = -1
    156.     @indexs = [self.x*2,self.width - self.x*2,self.x,self.width]if@indexs.nil?
    157.     @changes = false
    158.   end
    159.   def refresh
    160.     self.contents.clear
    161.     self.contents.font.color = normal_color
    162.     x = y = 0
    163.     @cursor_width = 0
    164.     # 到选择项的下一行字
    165.     if$game_temp.choice_start == 0
    166.       x = 8
    167.     end
    168.     # 有等待显示的文字的情况下
    169.     if$game_temp.message_text != nil
    170.       text = $game_temp.message_text
    171.       # 限制文字处理
    172.       begin
    173.         last_text = text.clone
    174.         text.gsub!(/\\[Vv]\[([0-9]+)\]/){$game_variables[$1.to_i]}
    175.       enduntil text == last_text
    176.       text.gsub!(/\\[Nn]\[([0-9]+)\]/)do
    177.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
    178.       end
    179.       # 为了方便、将 "\\\" 变换为 "\000"
    180.       text.gsub!(/\\\\/){"\000"}
    181.       # "\\C" 变为 "\001" 将
    182.       text.gsub!(/\\[Cc]\[([0-9]+)\]/){"\001[#{$1}]"}
    183.       # "\\G" 变为 "\002"
    184.       text.gsub!(/\\[Gg]/){"\002"}
    185.       # c 获取 1 个字 (如果不能取得文字就循环)
    186.       while((c = text.slice!(/./m)) != nil)
    187.         # \\ 的情况下
    188.         if c == "\000"
    189.           # 还原为本来的文字
    190.           c = "\"
    191.         end
    192.         # \C[n] 的情况下
    193.         if c == "\001"
    194.           # 更改文字色
    195.           text.sub!(/\[([0-9]+)\]/, "")
    196.           color = $1.to_i
    197.           if color >= 0and color = 128 ? 32 : 384
    198.             end
    199.             @gold_window.opacity = self.opacity
    200.             @gold_window.back_opacity = self.back_opacity
    201.           end
    202.           # 下面的文字
    203.           next
    204.         end
    205.         # 另起一行文字的情况下
    206.         if c == "\n"
    207.           # 刷新选择项及光标的高
    208.           if y >= $game_temp.choice_start
    209.             @cursor_width = [@cursor_width, x].max
    210.           end
    211.           # y 加 1
    212.           y += 1
    213.           x = 0
    214.           # 移动到选择项的下一行
    215.           if y >= $game_temp.choice_start
    216.             x = 8
    217.           end
    218.           # 下面的文字
    219.           next
    220.         end
    221.         # 描绘文字
    222.         unless$text_menu.nil?
    223.           if$text_menu[3] == 1
    224.             unless$text_menu[0][0].empty?
    225.               self.contents.draw_text(200 + 4 + x, 32 * y, 40, 32, c)
    226.               # x 为要描绘文字的加法运算,文字右移200像素
    227.               x += self.contents.text_size(c).width
    228.             else
    229.               self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
    230.               # x 为要描绘文字的加法运算
    231.               x += self.contents.text_size(c).width
    232.             end
    233.           else
    234.             self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
    235.             # x 为要描绘文字的加法运算
    236.             x += self.contents.text_size(c).width
    237.           end
    238.         else
    239.           self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
    240.           # x 为要描绘文字的加法运算
    241.           x += self.contents.text_size(c).width
    242.         end
    243.       end
    244.     end
    245.     # 选择项的情况
    246.     if$game_temp.choice_max > 0
    247.       @item_max = $game_temp.choice_max
    248.       self.active = true
    249.       self.index = 0
    250.     end
    251.     # 输入数值的情况
    252.     if$game_temp.num_input_variable_id > 0
    253.       digits_max = $game_temp.num_input_digits_max
    254.       number = $game_variables[$game_temp.num_input_variable_id]
    255.       @input_number_window = Window_InputNumber.new(digits_max)
    256.       @input_number_window.number = number
    257.       @input_number_window.x = self.x + 8
    258.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
    259.     end
    260.   end
    261.   def reset_window
    262.     if$game_temp.in_battle
    263.       self.y = 16
    264.     else
    265.       case$game_system.message_position
    266.       when0  # 上
    267.         self.y = 16
    268.       when1  # 中
    269.         self.y = 160
    270.       when2  # 下
    271.         self.y = 304
    272.       end
    273.     end
    274.     if$game_system.message_frame == 0
    275.       self.opacity = 255
    276.     else
    277.       self.opacity = 0
    278.     end
    279.     self.back_opacity = 160
    280.   end
    281.   def terminate_message
    282.     self.active = false
    283.     self.pause = false
    284.     self.index = -1
    285.     self.contents.clear
    286.     # 清除显示中标志
    287.     @contents_showing = false
    288.     # 呼叫信息调用
    289.     if$game_temp.message_proc != nil
    290.       $game_temp.message_proc.call
    291.     end
    292.     # 头像消失
    293.     $game_screen.tx_pictures[0].erase
    294.     $game_screen.tx_pictures[1].erase
    295.     $text_menu = nil
    296.     # 清除文章、选择项、输入数值的相关变量
    297.     $game_temp.message_text = nil
    298.     $game_temp.message_proc = nil
    299.     $game_temp.choice_start = 99
    300.     $game_temp.choice_max = 0
    301.     $game_temp.choice_cancel_type = 0
    302.     $game_temp.choice_proc = nil
    303.     $game_temp.num_input_start = 99
    304.     $game_temp.num_input_variable_id = 0
    305.     $game_temp.num_input_digits_max = 0
    306.     # 开放金钱窗口
    307.     if@gold_window != nil
    308.       @gold_window.dispose
    309.       @gold_window = nil
    310.     end
    311.   end
    312.   def update
    313.     super
    314.     # 渐变的情况下
    315.     if@fade_in
    316.       self.contents_opacity += 24
    317.       if@input_number_window != nil
    318.         @input_number_window.contents_opacity += 24
    319.       end
    320.       ifself.contents_opacity == 255
    321.         @fade_in = false
    322.       end
    323.       return
    324.     end
    325.     # 输入数值的情况下
    326.     if@input_number_window != nil
    327.       @input_number_window.update
    328.       # 确定
    329.       if Input.trigger?(Input::C)
    330.         $game_system.se_play($data_system.decision_se)
    331.         $game_variables[$game_temp.num_input_variable_id] =
    332.           @input_number_window.number
    333.         $game_map.need_refresh = true
    334.         # 释放输入数值窗口
    335.         @input_number_window.dispose
    336.         @input_number_window = nil
    337.         $game_screen.tx = true
    338.       end
    339.       return
    340.     end
    341.     # 显示信息中的情况下
    342.     if@contents_showing
    343.       unless$text_menu.nil?
    344.         if$text_menu[3] == 1
    345.           $game_screen.tx_pictures[0].show($text_menu[0][0], 0, self.y-100, $text_menu[2][0], $text_menu[2][1],$text_menu[0][1],$text_menu[0][2])
    346.           $game_screen.tx_pictures[1].show($text_menu[1][0], 420, self.y-100, $text_menu[2][0], $text_menu[2][1],$text_menu[1][1],$text_menu[1][2])
    347.         else
    348.           $game_screen.tx_pictures[0].show($text_menu[0][0], self.x-150, self.y-100, $text_menu[2][0], $text_menu[2][1],$text_menu[0][1],$text_menu[0][2])
    349.           $game_screen.tx_pictures[1].show($text_menu[1][0], self.x+self.width-40, self.y-100, $text_menu[2][0], $text_menu[2][1],$text_menu[1][1],$text_menu[1][2])
    350.         end
    351.       end
    352.       # 如果不是在显示选择项中就显示暂停标志
    353.       if$game_temp.choice_max == 0
    354.         self.pause = true
    355.       end
    356.       # 取消
    357.       if Input.trigger?(Input::B)
    358.         if$game_temp.choice_max > 0and$game_temp.choice_cancel_type > 0
    359.           $game_system.se_play($data_system.cancel_se)
    360.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
    361.           terminate_message
    362.         end
    363.       end
    364.       # 确定
    365.       if Input.trigger?(Input::C)
    366.         if$game_temp.choice_max > 0
    367.           $game_system.se_play($data_system.decision_se)
    368.           $game_temp.choice_proc.call(self.index)
    369.         end
    370.         terminate_message
    371.       end
    372.       return
    373.     end
    374.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
    375.     if@fade_out == falseand$game_temp.message_text != nil
    376.       # 判断对话框位置
    377.       unless$text_menu.nil?
    378.         if$text_menu[3] == 1
    379.           self.x = -10
    380.           self.width = 660
    381.           self.contents = Bitmap.new(self.width - 32, self.height - 32)
    382.         else
    383.           if$text_menu[0][0].empty?
    384.             self.x = 0
    385.             self.width = @indexs[3]
    386.             self.contents = Bitmap.new(@indexs[3] - 32, self.height - 32)
    387.           elsif$text_menu[1][0].empty?
    388.             self.x = @indexs[0]
    389.             self.width = @indexs[3]
    390.             self.contents = Bitmap.new(@indexs[3] - 32, self.height - 32)
    391.           else
    392.             self.x=@indexs[0]
    393.             self.width = @indexs[1]
    394.             self.contents = Bitmap.new(self.width - 32, self.height - 32)
    395.           end
    396.         end
    397.       else
    398.         self.x = @indexs[2]
    399.         self.width = @indexs[3]
    400.         self.contents = Bitmap.new(@indexs[3] - 32, self.height - 32)
    401.       end
    402.       @contents_showing = true
    403.       $game_temp.message_window_showing = true
    404.       reset_window
    405.       refresh
    406.       Graphics.frame_reset
    407.       self.visible = true
    408.       self.contents_opacity = 0
    409.       if@input_number_window != nil
    410.         @input_number_window.contents_opacity = 0
    411.       end
    412.       @fade_in = true
    413.       return
    414.     end
    415.     # 没有可以显示的信息、但是窗口为可见的情况下
    416.     ifself.visible
    417.       @fade_out = true
    418.       self.opacity -= 48
    419.       ifself.opacity == 0
    420.         self.visible = false
    421.         @fade_out = false
    422.         $game_temp.message_window_showing = false
    423.       end
    424.       return
    425.     end
    426.   end
    427. end
    428. class Game_Screen
    429.   attr_accessor :tx_pictures
    430.   def initialize
    431.     @tone = Tone.new(0, 0, 0, 0)
    432.     @tone_target = Tone.new(0, 0, 0, 0)
    433.     @tone_duration = 0
    434.     @flash_color = Color.new(0, 0, 0, 0)
    435.     @flash_duration = 0
    436.     @shake_power = 0
    437.     @shake_speed = 0
    438.     @shake_duration = 0
    439.     @shake_direction = 1
    440.     @shake = 0
    441.     @pictures = [nil]
    442.     @tx_pictures=[]
    443.     for i in1..100
    444.       @pictures.push(Game_Picture.new(i))
    445.     end
    446.     for i in0..1
    447.       @tx_pictures.push(Game_Character_Picture.new(i))
    448.     end
    449.     @weather_type = 0
    450.     @weather_max = 0.0
    451.     @weather_type_target = 0
    452.     @weather_max_target = 0.0
    453.     @weather_duration = 0
    454.   end
    455.   def update
    456.     if@tone_duration >= 1
    457.       d = @tone_duration
    458.       @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
    459.       @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
    460.       @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
    461.       @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
    462.       @tone_duration -= 1
    463.     end
    464.     if@flash_duration >= 1
    465.       d = @flash_duration
    466.       @flash_color.alpha = @flash_color.alpha * (d - 1) / d
    467.       @flash_duration -= 1
    468.     end
    469.     if@shake_duration >= 1or@shake != 0
    470.       delta = (@shake_power * @shake_speed * @shake_direction) / 10.0
    471.       if@shake_duration  @shake_power * 2
    472.         @shake_direction = -1
    473.       end
    474.       if@shake < - @shake_power * 2
    475.         @shake_direction = 1
    476.       end
    477.       if@shake_duration >= 1
    478.         @shake_duration -= 1
    479.       end
    480.     end
    481.     if@weather_duration >= 1
    482.       d = @weather_duration
    483.       @weather_max = (@weather_max * (d - 1) + @weather_max_target) / d
    484.       @weather_duration -= 1
    485.       if@weather_duration == 0
    486.         @weather_type = @weather_type_target
    487.       end
    488.     end
    489.     if$game_temp.in_battle
    490.       for i in51..100
    491.         @pictures[i].update
    492.       end
    493.     else
    494.       for i in1..50
    495.         @pictures[i].update
    496.       end
    497.     end
    498.     for i in0..1
    499.       @tx_pictures[i].update
    500.     end
    501.   end
    502. end
    503. #==============================================================================
    504. # ■ Spriteset_Map
    505. #------------------------------------------------------------------------------
    506. #  处理地图画面活动块和元件的类。本类在
    507. # Scene_Map 类的内部使用。
    508. #==============================================================================
    509. class Spriteset_Map
    510.   #--------------------------------------------------------------------------
    511.   # ● 初始化对像
    512.   #--------------------------------------------------------------------------
    513.   def initialize
    514.     # 生成显示端口
    515.     @viewport1 = Viewport.new(0, 0, 640, 480)
    516.     @viewport2 = Viewport.new(0, 0, 640, 480)
    517.     @viewport3 = Viewport.new(0, 0, 640, 480)
    518.     @viewport4 = Viewport.new(0, 0, 640, 480)
    519.     @viewport2.z = 200
    520.     @viewport3.z = 5000
    521.     @viewport4.z = 9998
    522.     # 生成元件地图
    523.     @tilemap = Tilemap.new(@viewport1)
    524.     @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
    525.     for i in0..6
    526.       autotile_name = $game_map.autotile_names[i]
    527.       @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
    528.     end
    529.     @tilemap.map_data = $game_map.data
    530.     @tilemap.priorities = $game_map.priorities
    531.     # 生成远景平面
    532.     @panorama = Plane.new(@viewport1)
    533.     @panorama.z = -1000
    534.     # 生成覆盖远景平面
    535. #    if DKRM::FUNC_TWOMAP
    536. #      @panoramaz = Plane.new(@viewport1)
    537. #      @panoramaz.z = 2999
    538. #    end
    539.     # 生成雾平面
    540.     @fog = Plane.new(@viewport1)
    541.     @fog.z = 3000
    542.     # 生成角色活动块
    543.     @character_sprites = []
    544.     for i in$game_map.events.keys.sort
    545.       sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
    546.       @character_sprites.push(sprite)
    547.     end
    548.     @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
    549.     # 生成天气
    550.     @weather = RPG::Weather.new(@viewport1)
    551.     # 生成图片
    552.     @picture_sprites = []
    553.     for i in1..50
    554.       @picture_sprites.push(Sprite_Picture.new(@viewport2,
    555.         $game_screen.pictures[i]))
    556.     end
    557.     @tx_picture_sprites = []
    558.     for i in0..1
    559.       @tx_picture_sprites.push(Sprite_Picture.new(@viewport4,
    560.       $game_screen.tx_pictures[i]))
    561.     end
    562.     # 生成计时器块
    563.     @timer_sprite = Sprite_Timer.new
    564.     # 刷新画面
    565.     update
    566.   end
    567.   #--------------------------------------------------------------------------
    568.   # ● 释放
    569.   #--------------------------------------------------------------------------
    570.   def dispose
    571.     # 释放元件地图
    572.     @tilemap.tileset.dispose
    573.     for i in0..6
    574.       @tilemap.autotiles[i].dispose
    575.     end
    576.     @tilemap.dispose
    577.     # 释放远景平面
    578.     @panorama.dispose
    579.     # 释放覆盖远景平面
    580. #    if DKRM::FUNC_TWOMAP
    581. #      @panoramaz.dispose
    582. #    end
    583.     # 释放雾平面
    584.     @fog.dispose
    585.     # 释放角色活动块
    586.     for sprite in@character_sprites
    587.       sprite.dispose
    588.     end
    589.     # 释放天候
    590.     @weather.dispose
    591.     # 释放图片
    592.     for sprite in@picture_sprites
    593.       sprite.dispose
    594.     end
    595.     for sprite in@tx_picture_sprites
    596.       sprite.dispose
    597.     end
    598.     # 释放计时器块
    599.     @timer_sprite.dispose
    600.     # 释放显示端口
    601.     @viewport1.dispose
    602.     @viewport2.dispose
    603.     @viewport3.dispose
    604.     @viewport4.dispose
    605.   end
    606.   #--------------------------------------------------------------------------
    607.   # ● 刷新画面
    608.   #--------------------------------------------------------------------------
    609.   def update
    610.     # 远景与现在的情况有差异发情况下
    611.     if@panorama_name != $game_map.panorama_nameor
    612.        @panorama_hue != $game_map.panorama_hue
    613.       @panorama_name = $game_map.panorama_name
    614.       @panorama_hue = $game_map.panorama_hue
    615.       if@panorama.bitmap != nil
    616.         @panorama.bitmap.dispose
    617.         @panorama.bitmap = nil
    618.       end
    619.       if@panorama_name != ""
    620.         @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
    621. #        if DKRM::FUNC_TWOMAP and\
    622. #          FileTest.exist?("Graphics/Panoramas/" + @panorama_name + "_2.png")
    623. #          @panoramaz.bitmap = RPG::Cache.panorama(@panorama_name + "_2"\
    624. #          ,@panorama_hue)
    625. #        end
    626.       end
    627.       Graphics.frame_reset
    628.     end
    629.     # 雾与现在的情况有差异的情况下
    630.     if@fog_name != $game_map.fog_nameor@fog_hue != $game_map.fog_hue
    631.       @fog_name = $game_map.fog_name
    632.       @fog_hue = $game_map.fog_hue
    633.       if@fog.bitmap != nil
    634.         @fog.bitmap.dispose
    635.         @fog.bitmap = nil
    636.       end
    637.       if@fog_name != ""
    638.         @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
    639.       end
    640.       Graphics.frame_reset
    641.     end
    642.     # 刷新元件地图
    643.     @tilemap.ox = $game_map.display_x / 4
    644.     @tilemap.oy = $game_map.display_y / 4
    645.     @tilemap.update
    646.     # 刷新远景与覆盖远景平面
    647.     m = 8
    648. #    if DKRM::FUNC_TWOMAP
    649. #      m = 4
    650. #      @panoramaz.ox = $game_map.display_x / 4
    651. #      @panoramaz.oy = $game_map.display_y / 4
    652. #    end
    653.     @panorama.ox = $game_map.display_x / m
    654.     @panorama.oy = $game_map.display_y / m
    655.     # 刷新雾平面
    656.     @fog.zoom_x = $game_map.fog_zoom / 100.0
    657.     @fog.zoom_y = $game_map.fog_zoom / 100.0
    658.     @fog.opacity = $game_map.fog_opacity
    659.     @fog.blend_type = $game_map.fog_blend_type
    660.     @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
    661.     @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
    662.     @fog.tone = $game_map.fog_tone
    663.     # 刷新角色活动块
    664.     for sprite in@character_sprites
    665.       sprite.update
    666.     end
    667.     # 刷新天候图形
    668.     @weather.type = $game_screen.weather_type
    669.     @weather.max = $game_screen.weather_max
    670.     @weather.ox = $game_map.display_x / 4
    671.     @weather.oy = $game_map.display_y / 4
    672.     @weather.update
    673.     # 刷新图片
    674.     for sprite in@picture_sprites
    675.       sprite.update
    676.     end
    677.     for sprite in@tx_picture_sprites
    678.       sprite.update
    679.     end
    680.     # 刷新计时器块
    681.     @timer_sprite.update
    682.     # 设置画面的色调与震动位置
    683.     @viewport1.tone = $game_screen.tone
    684.     @viewport1.ox = $game_screen.shake
    685.     # 设置画面的闪烁色
    686.     @viewport3.color = $game_screen.flash_color
    687.     # 刷新显示端口
    688.     @viewport1.update
    689.     @viewport3.update
    690.     @viewport4.update
    691.   end
    692. end
    复制代码

                本帖来自P1论坛作者wolves,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=376616  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 论坛版权

    使用道具 举报

    ahome_bigavatar:guest
    ahome_bigavatar:welcomelogin
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2024-5-14 00:41 , Processed in 0.050490 second(s), 44 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表