赞 | 274 |
VIP | 0 |
好人卡 | 0 |
积分 | 158 |
经验 | 515 |
最后登录 | 2024-11-8 |
在线时间 | 2106 小时 |
Lv4.逐梦者
- 梦石
- 1
- 星屑
- 14790
- 在线时间
- 2106 小时
- 注册时间
- 2017-9-28
- 帖子
- 662
|
签名档
- #==============================================================================
- # ■ RGSS3 地图和行走图的波形图 Ver1.00 by 星潟
- #------------------------------------------------------------------------------
- # 将波形图应用于地图和行走图。
- # 实际上是将地图和行走图的视口图像保存为单个图像,然后将波形图应用于该图像。
- # 波形图是通过在地图和角色上方显示来实现的。
- #
- # 默认情况下,可以模拟水下,沙漠和船晃动的效果。
- #==============================================================================
- module MapWaveEffect
-
- #请留空。
-
- W = {}
-
- #波形变量
-
- VID = 59
-
- #波形图视口变量名称。 (无需更改)
-
- TV = ["@viewport1"]
-
- #波形图z坐标
-
- TVZ = 100000000
-
- #波形图更新间隔帧数,数字越小,画面越顺滑,消耗资源越多
-
- Frequence = 2
-
- #设定波形图,
- #例子.
- #W[波形变量的值] = {
- #:amp => 振幅,
- #:length => 波长,
- #:speed => 波速,
- #:zoom_x => x缩放,
- #:zoom_y => y缩放}
-
- #水中
- W[1] = { #当波形变量=1时
- :amp => 1, #振幅=1
- :length => 60, #波长=60
- :speed => 60, #波速=60
- :zoom_x => 1.000, #无x缩放
- :zoom_y => 1.000} #无y缩放
-
- #沙漠
- W[2] = {
- :amp => 1,
- :length => 30,
- :speed => 10,
- :zoom_x => 1.002,
- :zoom_y => 1.002}
-
- #船晃动
-
- W[3] = {
- :amp => 2,
- :length => 40,
- :speed => 5,
- :zoom_x => 1.002,
- :zoom_y => 1.002}
-
- end
- class Game_Map
- attr_accessor :map_wave_phase
- end
- class Spriteset_Map
- #--------------------------------------------------------------------------
- # ビューポートの解放
- #--------------------------------------------------------------------------
- alias dispose_viewports_wave_effect dispose_viewports
- def dispose_viewports
- dispose_wave_viewport_sprite
- dispose_viewports_wave_effect
- end
- #--------------------------------------------------------------------------
- # ビューポートの更新
- #--------------------------------------------------------------------------
- alias update_viewports_wave_effect update_viewports
- def update_viewports
- update_viewports_wave_effect
- update_wave_viewport_sprite
- end
- #--------------------------------------------------------------------------
- # 波形描画スプライトの更新
- #--------------------------------------------------------------------------
- def update_wave_viewport_sprite
- wave_v = $game_variables[MapWaveEffect::VID]
- if @last_wave != wave_v
- @last_wave = wave_v
- dispose_wave_viewport_sprite if @wave_viewport_sprite
- if MapWaveEffect::W[wave_v]
- a = MapWaveEffect::TV.collect {|v| eval(v)}
- @wave_viewport_sprite ||= Sprite_MapWave.new(nil,a)
- end
- $game_map.map_wave_phase = nil
- end
- @wave_viewport_sprite.update if @wave_viewport_sprite
- end
- #--------------------------------------------------------------------------
- # 波形描画スプライトの解放
- #--------------------------------------------------------------------------
- def dispose_wave_viewport_sprite
- if @wave_viewport_sprite
- @wave_viewport_sprite.dispose
- @wave_viewport_sprite = nil
- end
- end
- end
- class Sprite_MapWave < Sprite
- #--------------------------------------------------------------------------
- # 初期化
- #--------------------------------------------------------------------------
- def initialize(main_viewport,target_viewports)
- super(main_viewport)
- @target_viewports = target_viewports
- @setting = MapWaveEffect::W[$game_variables[MapWaveEffect::VID]]
- self.wave_amp = @setting[:amp]
- self.wave_length = @setting[:length]
- self.wave_speed = @setting[:speed]
- self.zoom_x = @setting[:zoom_x]
- self.zoom_y = @setting[:zoom_y]
- self.wave_phase = $game_map.map_wave_phase if $game_map.map_wave_phase
- self.z = (@target_viewports.max_by {|v| v.z}).z
- @update_count = 0
- end
- #--------------------------------------------------------------------------
- # 初期化
- #--------------------------------------------------------------------------
- def update
- super
- update_bitmap
- update_position
- $game_map.map_wave_phase = self.wave_phase
- end
- #--------------------------------------------------------------------------
- # ビットマップ更新
- #--------------------------------------------------------------------------
- def update_bitmap
- if @update_count == 0
- dispose_bitmap
- az = MapWaveEffect::TVZ
- @target_viewports.each {|v| v.z += az}
- self.bitmap = Graphics.snap_to_bitmap
- @target_viewports.each {|v| v.z -= az}
- end
- @update_count += 1
- @update_count = 0 if @update_count >= MapWaveEffect::Frequence
- end
- #--------------------------------------------------------------------------
- # 位置の更新
- #--------------------------------------------------------------------------
- def update_position
- self.ox = self.bitmap.width * (@setting[:zoom_x] - 1) / 2
- self.oy = self.bitmap.height * (@setting[:zoom_y] - 1) / 2
- end
- #--------------------------------------------------------------------------
- # 解放
- #--------------------------------------------------------------------------
- def dispose
- dispose_bitmap
- super
- end
- #--------------------------------------------------------------------------
- # ビットマップ解放
- #--------------------------------------------------------------------------
- def dispose_bitmap
- self.bitmap.dispose if self.bitmap
- self.bitmap = nil
- end
- end
复制代码 |
评分
-
查看全部评分
|