赞 | 0 |
VIP | 0 |
好人卡 | 2 |
积分 | 1 |
经验 | 605 |
最后登录 | 2012-8-6 |
在线时间 | 13 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 13 小时
- 注册时间
- 2011-9-3
- 帖子
- 11
|
3楼

楼主 |
发表于 2011-9-17 01:04:59
|
只看该作者
这是在RPG::Sprite 中的animation(animation, hit) 方法的定义 还有update_animation
的 这个在f1里有
def animation(animation, hit)
dispose_animation
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation) //???????????
for i in 0..15 //问号间的这一段弄了16个
sprite = ::Sprite.new(self.viewport) 存储着动画图片的精灵
sprite.bitmap = bitmap 保存在了@_animation_sprites
sprite.visible = false 数组中 意思是最长16帧么
@_animation_sprites.push(sprite) 还有那个!= 3 的条件是什么意思
end //??????????
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data //这里cell_data的值估计在数据库里
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position) //???调用这个函数是显示单帧图像的么?
for timing in @_animation.timings
if timing.frame == frame_index
animation_process_timing(timing, @_animation_hit) //这个timing 也没看懂啥意思
end //能帮我看看这个函数大概在干啥么
end
else
dispose_animation
end
end
帮忙看看吧 有时代码看多了脑袋打结 一头雾水了 代码比较长 辛苦 谢谢了 !
行舟如夜于2011-9-17 02:02补充以下内容:
嗯 我基本搞懂了
16的意思是一帧里最多有16个动画元素
3表示全屏动画 那个判断是为了不重复播放全屏动画
那个函数确实是调整精灵的参数进行显示的 函数中用16次循环将16个动画元素全都画好了
animation_process_timing(timing, @_animation_hit) 这个函数还是没看懂 求解答 |
|