查看: 1164|回复: 3

伤害数值弹出时的运动轨迹如何修改?

  [复制链接]
头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-8-22
回帖
59
发表于 2009-3-24 06:47:38 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
梦石
0
星屑
61
在线时间
24 小时
注册时间
2008-8-5
回帖
1912
发表于 2009-3-25 12:24:36 | 显示全部楼层
module RPG
  class Sprite < ::Sprite
    def update
      super
      if @_whiten_duration > 0
        @_whiten_duration -= 1
        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
      end
      if @_appear_duration > 0
        @_appear_duration -= 1
        self.opacity = (16 - @_appear_duration) * 16
      end
      if @_escape_duration > 0
        @_escape_duration -= 1
        self.opacity = 256 - (32 - @_escape_duration) * 10
      end
      if @_collapse_duration > 0
        @_collapse_duration -= 1
        self.opacity = 256 - (48 - @_collapse_duration) * 6
      end
      if @_damage_duration > 0
        @_damage_duration -= 1
        case @_damage_duration
        when 38..39
          @_damage_sprite.y -= 4
        when 36..37
          @_damage_sprite.y -= 2
        when 34..35
          @_damage_sprite.y += 2
        when 28..33
          @_damage_sprite.y += 4
        end
        @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
        if @_damage_duration == 0
          dispose_damage
        end
      end

      if @_animation != nil and (Graphics.frame_count % 2 == 0)
        @_animation_duration -= 1
        update_animation
      end
      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
        update_loop_animation
        @_loop_animation_index += 1
        @_loop_animation_index %= @_loop_animation.frame_max
      end
      if @_blink
        @_blink_count = (@_blink_count + 1) % 32
        if @_blink_count < 16
          alpha = (16 - @_blink_count) * 6
        else
          alpha = (@_blink_count - 16) * 6
        end
        self.color.set(255, 255, 255, alpha)
      end
      @@_animations.clear
    end
  end
end


红色部分就是了,@_damage_sprite 就是显示伤害的精灵,修改 x、y、opacity 等属性就能改变伤害显示的轨迹了~
@_damage_duration 是显示伤害的持续时间,从 40 开始每帧自减 1
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-8-22
回帖
59
 楼主| 发表于 2009-3-25 16:41:24 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

蚂蚁卡卡

梦石
0
星屑
116
在线时间
66 小时
注册时间
2007-12-16
回帖
2991
发表于 2009-3-25 17:08:03 | 显示全部楼层
f1里 搜索 rpg::sprite
知其然知其所以然 好
《隋唐乱》完整解密版点击进入
米兰,让我怎么说离开……

曾经我也是一个有志青年,直到我膝盖中了一箭……

《隋唐乱》博客地址
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部