赞 | 5 |
VIP | 464 |
好人卡 | 4 |
积分 | 4 |
经验 | 14189 |
最后登录 | 2020-6-13 |
在线时间 | 972 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 398
- 在线时间
- 972 小时
- 注册时间
- 2007-12-31
- 帖子
- 2137
|
本帖最后由 liqunsz 于 2010-11-3 21:00 编辑
真的无法保证使用效果!请注意!
我记得美兽有一个图片显示加强
那个AVG的精装版里面有移过去闪白的脚本,不过是在鼠标响应图片里面的- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #格式:显示的cmd图片的命名格式为:
- # cmd调用公共事件编号_名字
- # cmd调用公共事件编号_名字_02 # 此为鼠标经过的图片
- #
- #即,带有cmd的为可以点击的图片,点击后执行相应的公共事件.....
- #不带cmd的图片没任何影响。。。
- #==============================================================================
- class Game_Picture
- def name=(str)
- @name = str
- end
- end
- class Sprite_Picture
-
- # 这里设置闪烁颜色
- FLASH_COLOR = Color.new(255,255,255,0)
-
- alias update_old update
- def update
- update_old
- begin
- return if @picture_name[/cmd/].nil? or @picture_name == ""
- rescue
- return
- end
- mx,my = Mouse.get_mouse_pos
- lx = self.x - self.ox
- rx = lx + self.bitmap.width
- ty = self.y - self.oy
- by = ty + self.bitmap.height
- if mx < lx or mx > rx or my < ty or my > by or
- self.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
- @picture.finish_flash if @picture.flash?
- @picture.name = @picture.name.split(/_/)[0]+"_"[email protected](/_/)[1]
- return
- end
- if @picture.name.split(/_/)[2].nil?
- picname = @picture.name + "_02"
- #第2张图片不存在的时候不显示
- if FileTest.exist?("Graphics/Pictures/#{picname}.png")
- @picture.name = picname
- picname2 = @picture.name.split(/_/)[1] + "map"
- if FileTest.exist?("Graphics/Pictures/#{picname2}.png")
- $mapname = picname2
-
- end
- else#不存在图片就闪烁
- unless @picture.flash?
- @picture.start_flash(FLASH_COLOR)
- end
- end
- end
- #对话框存在的时候不启动事件
- if Mouse.trigger?(Mouse::LEFT) and !$game_system.map_interpreter.running?
- @picture.name.split(/_/)[0].sub(/cmd([0-9]+)/,"")
- $game_temp.common_event_id = $1.to_i
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 注意用了- @picture.start_flash(FLASH_COLOR)
复制代码 然后两个改动的脚本,替换原脚本
Game_Picture- #==============================================================================
- # ■ Game_Picture
- #AVG关于图片属性的一些修改感谢美兽大的图片加强显示
- #------------------------------------------------------------------------------
- # 处理图片的类。本类在类 Game_Screen ($game_screen)
- # 的内部使用。
- #==============================================================================
- class Game_Picture
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- #★★---★★---★★---★★---★★---★★---★★---★★#
- attr_accessor :number # 图片编号
- attr_accessor :name # 文件名
- attr_accessor :origin # 原点
- attr_accessor :x # X 坐标
- attr_accessor :y # Y 坐标
- attr_accessor :zoom_x # X 方向放大率
- attr_accessor :zoom_y # Y 方向放大率
- attr_accessor :opacity # 不透明度
- attr_accessor :blend_type # 合成方式
- attr_accessor :tone # 色调
- attr_accessor :angle # 旋转角度
- attr_accessor :mirror # 翻转
- attr_accessor :bush_depth # 繁茂度
- #★★---★★---★★---★★---★★---★★---★★---★★#
- attr_reader :flash_color # 闪烁色#AVG
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # number : 图片编号
- #--------------------------------------------------------------------------
- def initialize(number)
- @number = number
- @name = ""
- @origin = 0
- @x = 0.0
- @y = 0.0
- @zoom_x = 100.0
- @zoom_y = 100.0
- @opacity = 255.0
- @blend_type = 1
- @duration = 0
- @target_x = @x
- @target_y = @y
- @target_zoom_x = @zoom_x
- @target_zoom_y = @zoom_y
- @target_opacity = @opacity
- @tone = Tone.new(0, 0, 0, 0)
- @tone_target = Tone.new(0, 0, 0, 0)
- @tone_duration = 0
- @angle = 0
- @rotate_speed = 0
- #★★---★★---★★---★★---★★---★★---★★---★★#
- @move_angle = 0 # 新角度
- @rotate_duration = 0 # 旋转时间
- @mirror = false # 翻转
- @move_mirror = false # 翻转标志
- @mirror_duration = 0 # 翻转时间
- @mirror_duration_half = 0 # 翻转点
- @mirror_zoom = 0 # 翻转缩放量
- @bush_depth = 0 # 繁茂度
- @move_bush = 0 # 繁茂增量
- @bush_duration = 0 # 繁茂变化时间
- #★★---★★---★★---★★---★★---★★---★★---★★#
- #AVG
- @flash_color = Color.new(0, 0, 0, 0)
- @flashing = false
- end
- #★★---★★---★★---★★---★★---★★---★★---★★#
- #--------------------------------------------------------------------------
- # ● 繁茂移动
- #--------------------------------------------------------------------------
- def bush_move(depth,duration)
- return if duration == 0
- @move_bush = (depth - @bush_depth).to_f / duration
- @bush_duration = duration
- return
- end
- #--------------------------------------------------------------------------
- # ● 翻转移动
- #--------------------------------------------------------------------------
- def mir_move(mir,duration)
- return if @mirror == mir
- @mirror_duration_half = duration / 2
- @mirror_duration = @mirror_duration_half * 2
- @mirror_zoom = @zoom_x / @mirror_duration_half
- @move_mirror = mir
- return
- end
- #--------------------------------------------------------------------------
- # ● 旋转移动
- # angle : 新角度
- # duration : 时间
- #--------------------------------------------------------------------------
- def rotate_move(angle,duration)
- @move_angle = (angle - @angle).to_f / duration
- @rotate_duration = duration
- return
- end
- #★★---★★---★★---★★---★★---★★---★★---★★#
- #AVG
- #--------------------------------------------------------------------------
- # ● 开始图片闪烁
- # color : 闪烁颜色
- #--------------------------------------------------------------------------
- def start_flash(color)
- @flash_color = color.clone
- @flashing = true
- @flash_count = 16
- @flash_reverse = false
- @ready_finish = false
- end
- #--------------------------------------------------------------------------
- # ● 闪烁中判定
- #--------------------------------------------------------------------------
- def flash?
- return @flashing
- end
- #--------------------------------------------------------------------------
- # ● 闪烁结束
- #--------------------------------------------------------------------------
- def finish_flash
- @ready_finish = true
- end
-
- def y=(y)
- @y = y
- end
-
- #--------------------------------------------------------------------------
- # ● 显示图片
- # name : 文件名
- # origin : 原点
- # x : X 坐标
- # y : Y 坐标
- # zoom_x : X 方向放大率
- # zoom_y : Y 方向放大率
- # opacity : 不透明度
- # blend_type : 合成方式
- #--------------------------------------------------------------------------
- def show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
- @name = name
- @origin = origin
- @x = x.to_f
- @y = y.to_f
- @zoom_x = zoom_x.to_f
- @zoom_y = zoom_y.to_f
- @opacity = opacity.to_f
- @blend_type = blend_type
- @duration = 0
- @target_x = @x
- @target_y = @y
- @target_zoom_x = @zoom_x
- @target_zoom_y = @zoom_y
- @target_opacity = @opacity
- @tone = Tone.new(0, 0, 0, 0)
- @tone_target = Tone.new(0, 0, 0, 0)
- @tone_duration = 0
- @angle = 0
- @rotate_speed = 0
- end
- #--------------------------------------------------------------------------
- # ● 移动图片
- # duration : 时间
- # origin : 原点
- # x : X 坐标
- # y : Y 坐标
- # zoom_x : X 方向放大率
- # zoom_y : Y 方向放大率
- # opacity : 不透明度
- # blend_type : 合成方式
- #--------------------------------------------------------------------------
- def move(duration, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
- @duration = duration
- @origin = origin
- @target_x = x.to_f
- @target_y = y.to_f
- @target_zoom_x = zoom_x.to_f
- @target_zoom_y = zoom_y.to_f
- @target_opacity = opacity.to_f
- @blend_type = blend_type
- end
- #--------------------------------------------------------------------------
- # ● 更改旋转速度
- # speed : 旋转速度
- #--------------------------------------------------------------------------
- def rotate(speed)
- @rotate_speed = speed
- end
- #--------------------------------------------------------------------------
- # ● 开始更改色调
- # tone : 色调
- # duration : 时间
- #--------------------------------------------------------------------------
- def start_tone_change(tone, duration)
- @tone_target = tone.clone
- @tone_duration = duration
- if @tone_duration == 0
- @tone = @tone_target.clone
- end
- end
- #--------------------------------------------------------------------------
- # ● 消除图片
- #--------------------------------------------------------------------------
- def erase
- @name = ""
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- if @duration >= 1
- d = @duration
- @x = (@x * (d - 1) + @target_x) / d
- @y = (@y * (d - 1) + @target_y) / d
- @zoom_x = (@zoom_x * (d - 1) + @target_zoom_x) / d
- @zoom_y = (@zoom_y * (d - 1) + @target_zoom_y) / d
- @opacity = (@opacity * (d - 1) + @target_opacity) / d
- @duration -= 1
- end
- if @tone_duration >= 1
- d = @tone_duration
- @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
- @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
- @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
- @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
- @tone_duration -= 1
- end
- if @rotate_speed != 0
- @angle += @rotate_speed / 2.0
- while @angle < 0
- @angle += 360
- end
- @angle %= 360
- end
-
- #AVG
- if @flashing
- if @flash_reverse
- @flash_count += 1
- @flash_reverse = false if @flash_count >= 16
- else
- @flash_count -= 1
- @flash_reverse = true if @flash_count <= 0
- end
- @flash_color.alpha = (16 - @flash_count) * 10
- @flashing = false if @ready_finish and @flash_count == 16
- end
-
- #★★---★★---★★---★★---★★---★★---★★---★★#
- if @rotate_duration > 0
- @angle += @move_angle
- @rotate_duration -= 1
- end
- if @mirror_duration > 0
- if @move_mirror == @mirror
- @zoom_x += @mirror_zoom
- else
- @zoom_x -= @mirror_zoom
- end
- @mirror_duration -= 1
- if @mirror_duration == @mirror_duration_half
- @mirror = @move_mirror
- end
- end
- if @bush_duration > 0
- @bush_depth += @move_bush
- @bush_duration -= 1
- end
- #★★---★★---★★---★★---★★---★★---★★---★★#
- end
- end
复制代码 Sprite_Picture- #==============================================================================
- # ■ Sprite_Picture
- #------------------------------------------------------------------------------
- # 显示图片用的活动块。Game_Picture 类的实例监视、
- # 活动块状态的自动变化。
- #==============================================================================
- class Sprite_Picture < Sprite
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # viewport : 显示端口
- # picture : 图片 (Game_Picture)
- #--------------------------------------------------------------------------
- def initialize(viewport, picture)
- super(viewport)
- @picture = picture
- update
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
- super
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- #★★---★★---★★---★★---★★---★★---★★---★★#
- self.mirror = @picture.mirror
- self.bush_depth = @picture.bush_depth
- #★★---★★---★★---★★---★★---★★---★★---★★#
- # 图片的文件名与当前的情况有差异的情况下
- if @picture_name != @picture.name
- # 将文件名记忆到实例变量
- @picture_name = @picture.name
- # 文件名不为空的情况下
- if @picture_name != ""
- # 获取图片图形
- self.bitmap = RPG::Cache.picture(@picture_name)
- end
- end
- # 文件名是空的情况下
- if @picture_name == ""
- # 将活动块设置为不可见
- self.visible = false
- return
- end
- # 将活动块设置为可见
- self.visible = true
- #★★---★★---★★---★★---★★---★★---★★---★★#
- # 设置传送原点
- case @picture.origin
- when 0
- self.ox = 0
- self.oy = 0
- when 1
- self.ox = self.bitmap.width / 2
- self.oy = self.bitmap.height / 2
- when 2
- self.ox = self.bitmap.width
- self.oy = self.bitmap.height
- when 3
- self.ox = self.bitmap.width / 2
- self.oy = self.bitmap.height
- when 11
- self.ox = $game_variables[76].to_f / 100 * self.bitmap.width
- self.oy = $game_variables[77].to_f / 100 * self.bitmap.height
- when 12
- self.ox = $game_variables[76]
- self.oy = $game_variables[77]
- end
- #★★---★★---★★---★★---★★---★★---★★---★★#
- # 设置活动块的坐标
- self.x = @picture.x
- self.y = @picture.y
- self.z = @picture.number
- # 设置放大率、不透明度、合成方式
- self.zoom_x = @picture.zoom_x / 100.0
- self.zoom_y = @picture.zoom_y / 100.0
- self.opacity = @picture.opacity
- self.blend_type = @picture.blend_type
- # 设置旋转角度、色调
- self.angle = @picture.angle
- self.tone = @picture.tone
- # 设置闪烁色#AVG
- self.flash(@picture.flash_color, 1) if @picture.flash?
- end
- end
复制代码 应该就是改动了这些……有问题的话我再找找吧 |
|