这只是思路 要学脚本不能从我这思路学 要从头开始作者: 行舟如夜 时间: 2011-9-17 01:04
这是在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