zmz6668 发表于 2014-6-22 22:57:46

循环动画自动隐去脚本,如何改成挨打方不隐去?

用一个【正常】状态来添加循环待机动画。当使用了状态循环动画,攻击的时候,状态动画并不会消失(也就是屏
幕上同时播放循环动画和攻击动画,貌似角色分身的样子)。
用了这个循环动画自动隐去脚本.攻击方和挨打方状态循环动画都给同时隐去.请问如何改成挨打方循环动画不隐去
?攻击方隐去谢谢.


#==============================================================================

#==============================================================================
module RPG
class Sprite < ::Sprite
   def animation_set_sprites(sprites, cell_data, position, invisible = false)
   if invisible
       for i in 0..15
         sprites.visible = false
       end
       return
   end
   for i in 0..15
       sprite = sprites
       pattern = cell_data
       if sprite == nil or pattern == nil or pattern == -1
         sprite.visible = false if sprite != nil
         next
       end
       sprite.visible = true
       sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
       if position == 3
         if self.viewport != nil
         sprite.x = self.viewport.rect.width / 2
         sprite.y = self.viewport.rect.height - 160
         else
         sprite.x = 320
         sprite.y = 240
         end
       else
         sprite.x = self.x - self.ox + self.src_rect.width / 2
         sprite.y = self.y - self.oy + self.src_rect.height / 2
         sprite.y -= self.src_rect.height / 4 if position == 0
         sprite.y += self.src_rect.height / 4 if position == 2
       end
       sprite.x += cell_data
       sprite.y += cell_data
       sprite.z = 2000
       sprite.ox = 96
       sprite.oy = 96
       sprite.zoom_x = cell_data / 100.0
       sprite.zoom_y = cell_data / 100.0
       sprite.angle = cell_data
       sprite.mirror = (cell_data == 1)
       sprite.opacity = cell_data * self.opacity / 255.0
       sprite.blend_type = cell_data
   end
   end
   def update_loop_animation
   if @_animation_duration > 0
       frame_index = @_loop_animation_index
       cell_data = @_loop_animation.frames.cell_data
       position = @_loop_animation.position
       animation_set_sprites(@_loop_animation_sprites, cell_data, position,true)

   else
       frame_index = @_loop_animation_index
       cell_data = @_loop_animation.frames.cell_data
       position = @_loop_animation.position
       animation_set_sprites(@_loop_animation_sprites, cell_data, position)
       for timing in @_loop_animation.timings
         if timing.frame == frame_index
         animation_process_timing(timing, true)
         end
       end
   end
   end
end
end
#=================

secondsen 发表于 2014-6-23 13:39:38

你用了好多脚本吧,需要交互作用吧。。。只贴这个,谁知道是啥腌T_Tbbbb
页: [1]
查看完整版本: 循环动画自动隐去脚本,如何改成挨打方不隐去?