赞 | 0 |
VIP | 6 |
好人卡 | 0 |
积分 | 1 |
经验 | 3778 |
最后登录 | 2017-8-28 |
在线时间 | 61 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 61 小时
- 注册时间
- 2008-8-18
- 帖子
- 45
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
因游戏需要使用了柳柳大人制作的多个动画同时播放,覆盖了原来的Sprite_Base,但是发现还是只能播放1个,
先播放的动画被后来的动画给取消了。
请各位老大帮忙解决一下。
游戏使用了 :开头画面特效,地图作为战斗背景,更改窗口外观,国外的截图存档,
SV横版2.7汉化版,升级手动加点,物品分类,以及升级提示脚本。
- #==============================================================================
- # ■ Sprite_Base
- #------------------------------------------------------------------------------
- # 处理动画显示追加活动块的类变量。
- #==============================================================================
- class Sprite_Base < Sprite
- #--------------------------------------------------------------------------
- # ● 类变量
- # @@animations 用来记录动画正在播放,防止同一时间多次在同位置播放全屏动画
- # @@_reference_count 用来记录哪些素材正在被使用
- #--------------------------------------------------------------------------
- @@animations = []
- @@_reference_count = {}
- #--------------------------------------------------------------------------
- # ● done 初始化对像
- # viewport : 视口
- #--------------------------------------------------------------------------
- def initialize(viewport = nil)
- super(viewport)
- @use_sprite = true # 活动块使用标记
- @animation_duration = 0 # 动画剩余时间
- # 基本结构:animation, mirror, length, sprites, ox, oy ,[bitmap1, bitmap2]
- @animation_collection = []
- end
- #--------------------------------------------------------------------------
- # ● done 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- return if @animation_collection == nil
- for ani in @animation_collection
- dispose_animation(ani)
- end
- end
- #--------------------------------------------------------------------------
- # ● done 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- if @animation_collection != nil
- @animation_duration -= 1
- for ani in @animation_collection
- ani[2] -= 1
- if ani[2] % 4 == 0
- update_animation(ani)
- end
- end
- end
- @@animations.clear
- end
- #--------------------------------------------------------------------------
- # ● done 动画显示中判定
- #--------------------------------------------------------------------------
- def animation?
- return @animation_collection != nil
- end
- #--------------------------------------------------------------------------
- # ● done 开始动画
- #--------------------------------------------------------------------------
- def start_animation(animation, mirror = false)
- @animation = animation
- return if @animation == nil
- @animation_mirror = mirror
- animation_length = @animation.frame_max * 4 + 1
- @animation_duration += animation_length
- animbitmap = load_animation_bitmap
- @animation_sprites = []
- if @animation.position != 3 or not @@animations.include?(animation)
- if @use_sprite
- for i in 0..15
- sprite = ::Sprite.new(viewport)
- sprite.visible = false
- @animation_sprites.push(sprite)
- end
- unless @@animations.include?(animation)
- @@animations.push(animation)
- end
- end
- end
- if @animation.position == 3
- if viewport == nil
- @animation_ox = 544 / 2
- @animation_oy = 416 / 2
- else
- @animation_ox = viewport.rect.width / 2
- @animation_oy = viewport.rect.height / 2
- end
- else
- @animation_ox = x - ox + width / 2
- @animation_oy = y - oy + height / 2
- if @animation.position == 0
- @animation_oy -= height / 2
- elsif @animation.position == 2
- @animation_oy += height / 2
- end
- end
- @animation_collection.push([@animation, @animation_mirror, animation_length,
- @animation_sprites, @animation_ox, @animation_oy,
- animbitmap])
- end
- #--------------------------------------------------------------------------
- # ● done 读取动画的类变量
- #--------------------------------------------------------------------------
- def load_animation_bitmap
- animation1_name = @animation.animation1_name
- animation1_hue = @animation.animation1_hue
- animation2_name = @animation.animation2_name
- animation2_hue = @animation.animation2_hue
- @animation_bitmap1 = Cache.animation(animation1_name, animation1_hue)
- @animation_bitmap2 = Cache.animation(animation2_name, animation2_hue)
- if @@_reference_count.include?(@animation_bitmap1)
- @@_reference_count[@animation_bitmap1] += 1
- else
- @@_reference_count[@animation_bitmap1] = 1
- end
- if @@_reference_count.include?(@animation_bitmap2)
- @@_reference_count[@animation_bitmap2] += 1
- else
- @@_reference_count[@animation_bitmap2] = 1
- end
- Graphics.frame_reset
- return [@animation_bitmap1, @animation_bitmap2]
- end
- #--------------------------------------------------------------------------
- # ● done 释放动画
- #--------------------------------------------------------------------------
- def dispose_animation(ani)
- if ani[6][0] != nil
- @@_reference_count[ani[6][0]] -= 1
- if @@_reference_count[ani[6][0]] == 0
- ani[6][0].dispose
- end
- end
- if ani[6][1] != nil
- @@_reference_count[ani[6][1]] -= 1
- if @@_reference_count[ani[6][1]] == 0
- ani[6][1].dispose
- end
- end
- if ani[3] != nil
- for sprite in ani[3]
- sprite.dispose
- end
- @animation_sprites = nil
- @animation = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● done 刷新动画
- #--------------------------------------------------------------------------
- def update_animation(ani)
- if ani[2] > 0
- frame_index = ani[0].frame_max - (ani[2] + 3) / 4
- animation_set_sprites(ani[0].frames[frame_index], ani)
- for timing in ani[0].timings
- if timing.frame == frame_index
- animation_process_timing(timing)
- end
- end
- else
- dispose_animation(ani)
- end
- end
- #--------------------------------------------------------------------------
- # ● done 设置动画活动块
- # frame : 帧数据 (RPG::Animation::Frame)
- #--------------------------------------------------------------------------
- def animation_set_sprites(frame, ani)
- cell_data = frame.cell_data
- for i in 0..15
- sprite = ani[3][i]
- next if sprite == nil
- pattern = cell_data[i, 0]
- if pattern == nil or pattern == -1
- sprite.visible = false
- next
- end
- if pattern < 100
- sprite.bitmap = ani[6][0]
- else
- sprite.bitmap = ani[6][1]
- end
- sprite.visible = true
- sprite.src_rect.set(pattern % 5 * 192,
- pattern % 100 / 5 * 192, 192, 192)
- if @animation_mirror
- sprite.x = ani[4] - cell_data[i, 1]
- sprite.y = ani[5] - cell_data[i, 2]
- sprite.angle = (360 - cell_data[i, 4])
- sprite.mirror = (cell_data[i, 5] == 0)
- else
- sprite.x = ani[4] + cell_data[i, 1]
- sprite.y = ani[5] + cell_data[i, 2]
- sprite.angle = cell_data[i, 4]
- sprite.mirror = (cell_data[i, 5] == 1)
- end
- sprite.z = self.z + 300
- sprite.ox = 96
- sprite.oy = 96
- sprite.zoom_x = cell_data[i, 3] / 100.0
- sprite.zoom_y = cell_data[i, 3] / 100.0
- sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
- sprite.blend_type = cell_data[i, 7]
- end
- end
- #--------------------------------------------------------------------------
- # ● done SE 与闪烁的时机处理
- # timing : Timing数据 (RPG::Animation::Timing)
- #--------------------------------------------------------------------------
- def animation_process_timing(timing)
- timing.se.play
- case timing.flash_scope
- when 1
- self.flash(timing.flash_color, timing.flash_duration * 4)
- when 2
- if viewport != nil
- viewport.flash(timing.flash_color, timing.flash_duration * 4)
- end
- when 3
- self.flash(nil, timing.flash_duration * 4)
- end
- end
- end
复制代码
#以上是柳柳大人的脚本。 此贴于 2009-2-1 22:06:40 被版主木葬枫提醒,请楼主看到后对本贴做出回应。 此贴于 2009-2-4 11:18:33 被版主木葬枫提醒,请楼主看到后对本贴做出回应。 |
|