设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1377|回复: 1
打印 上一主题 下一主题

[已经过期] 战斗结束后角色名字与血条清除问题

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1556
在线时间
626 小时
注册时间
2010-8-5
帖子
451
跳转到指定楼层
1
发表于 2013-8-15 17:35:16 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
先附上脚本
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Sprite_Battler
  3. #------------------------------------------------------------------------------
  4. #  战斗显示用活动块。Game_Battler 类的实例监视、
  5. # 活动块的状态的监视。
  6. #==============================================================================
  7.  
  8. class Sprite_Battler < RPG::Sprite
  9.   #--------------------------------------------------------------------------
  10.   # ● 定义实例变量
  11.   #--------------------------------------------------------------------------
  12.   attr_accessor :battler                  # 战斗者
  13.   #--------------------------------------------------------------------------
  14.   # ● 初始化对像
  15.   #     viewport : 显示端口
  16.   #     battler  : 战斗者 (Game_Battler)
  17.   #--------------------------------------------------------------------------
  18.   def initialize(viewport, battler = nil)
  19.     super(viewport)
  20.     [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  21.     @battler_visible = false
  22.     [url=home.php?mod=space&uid=27178]@Number[/url] = 0
  23.     @sprite_contens = Sprite.new#(viewport)
  24.     @sprite_contens.x = 0
  25.     @sprite_contens.y = 0
  26.     @sprite_contens.z = 0
  27.     @sprite_contens.bitmap = Bitmap.new(640,480)
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 释放
  31.   #--------------------------------------------------------------------------
  32.   def dispose
  33.     if self.bitmap != nil
  34.       self.bitmap.dispose
  35.     end
  36.     super
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 战斗中名字的描绘
  40.   #--------------------------------------------------------------------------
  41.   def draw_actor_name(actor, x, y)
  42.     @sprite_contens.bitmap.font.color = Color.new(0, 230, 50, 255)
  43.     @sprite_contens.bitmap.font.size = 16
  44.     @sprite_contens.bitmap.draw_text(x, y, 60, 65, actor.name,1)
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 战斗血条描绘
  48.   #--------------------------------------------------------------------------
  49.   def draw_battle_hp(actor, x, y)
  50.     # 底图描绘
  51.     battle_hp_bitmap = RPG::Cache.picture("战斗条框")
  52.     src_rect = Rect.new(0, 0, battle_hp_bitmap.width, battle_hp_bitmap.height)
  53.     @sprite_contens.bitmap.blt(x, y, battle_hp_bitmap, src_rect)
  54.     # 血条显示
  55.     battle_hp_bitmap = RPG::Cache.picture("战斗血条")
  56.     hp_width = battle_hp_bitmap.width * actor.hp / actor.maxhp
  57.     src_rect = Rect.new(0, 0, hp_width, battle_hp_bitmap.height)
  58.     @sprite_contens.bitmap.blt(x+1, y+1, battle_hp_bitmap, src_rect)
  59.   end
  60.  
  61.   #--------------------------------------------------------------------------
  62.   # ● 刷新画面
  63.   #--------------------------------------------------------------------------
  64.   def update
  65.     super
  66.  
  67.       #刷新战斗血条
  68.     if @battler.is_a?(Game_Actor)
  69.       if not @sprite_contens.disposed?
  70.         if @battler_hp == 0 and not @battler.dead?
  71.           @sprite_contens.bitmap.clear
  72.           @sprite_contens.x = @battler.screen_x
  73.           @sprite_contens.y = @battler.screen_y
  74.           @sprite_contens.z = @battler.screen_z + 10
  75.           draw_actor_name(@battler, 0, 0)
  76.           #draw_battle_sp(@battler, 0, 27)
  77.           draw_battle_hp(@battler, 0, 0)
  78.           @battler_hp = @battler.hp
  79.         end
  80.         if @wait_count.to_i != 0
  81.           @sprite_contens.visible = false
  82.         else
  83.           @sprite_contens.visible = true
  84.         end
  85.       end
  86.     elsif @battler.is_a?(Game_Enemy)
  87.       unless @sprite_contens.disposed?
  88.         if @battler.hp0?
  89.           @sprite_contens.bitmap.clear
  90.         end
  91.       if @wait_count.to_i != 0
  92.         @sprite_contens.visible = false
  93.       else
  94.         @sprite_contens.visible = true
  95.       end
  96.       end
  97.     end
  98.  
  99.  
  100.     # 战斗者为 nil 的情况下
  101.     if @battler == nil
  102.       self.bitmap = nil
  103.       loop_animation(nil)
  104.       return
  105.     end
  106.     # 文件名和色相与当前情况有差异的情况下
  107.     if @battler.battler_name != @battler_name or
  108.        @battler.battler_hue != @battler_hue
  109.       # 获取、设置位图
  110.       @battler_name = @battler.battler_name
  111.       @battler_hue = @battler.battler_hue
  112.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  113.       @width = bitmap.width
  114.       [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
  115.       self.ox = @width / 2
  116.       self.oy = @height
  117.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  118.       if @battler.dead? or @battler.hidden
  119.         self.opacity = 0
  120.       end
  121.     end
  122.        if @battler.startactive == "移动" or @battler.startactive == "返回" or @battler.startactive == "挨打" or @battler.startactive == "防御" or @battler.startactive == "死亡"
  123.       if Graphics.frame_count % 2 == 0
  124.         unless BattlerName[@battler.name].nil?
  125.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  126.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  127.           #Graphics.update
  128.         end
  129.       end
  130.     else
  131.       if Graphics.frame_count % 3 == 0
  132.         unless BattlerName[@battler.name].nil?
  133.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  134.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  135.         end
  136.       end
  137.     end
  138.  
  139.     x, y = Mouse.get_mouse_pos
  140.     if x >= self.x - self.ox and x <= self.x + self.ox and y >= self.y - self.oy and y <= self.y and
  141.         self.bitmap.get_pixel(x - self.x + self.ox + self.src_rect.x, y - self.y + self.oy + self.src_rect.y).alpha > 0
  142.        self.tone.set(80, 80, 80)
  143.        @sprite_contens.bitmap.font.color = Color.new(0,30, 50, 0)
  144.      else
  145.        self.tone.set(0, 0, 0)
  146.       end
  147.     # 动画 ID 与当前的情况有差异的情况下
  148.     if @battler.damage == nil and
  149.        @battler.state_animation_id != @state_animation_id
  150.       @state_animation_id = @battler.state_animation_id
  151.       loop_animation($data_animations[@state_animation_id])
  152.     end
  153.  
  154.     # 不可见的情况下
  155.     unless @battler_visible
  156.     # 出现
  157.       if not @battler.hidden and not @battler.dead? and
  158.          (@battler.damage == nil or @battler.damage_pop)
  159.         appear
  160.         @battler_visible = true
  161.       end
  162.     end
  163.     # 可见的情况下
  164.     if @battler_visible
  165.       # 逃跑
  166.       if @battler.hidden
  167.         $game_system.se_play($data_system.escape_se)
  168.         escape
  169.         @battler_visible = false
  170.       end
  171.       # 白色闪烁
  172.       if @battler.white_flash
  173.         whiten
  174.         @battler.white_flash = false
  175.       end
  176.       # 动画
  177.       if @battler.animation_id != 0
  178.         animation = $data_animations[@battler.animation_id]
  179.         animation(animation, @battler.animation_hit)
  180.         @battler.animation_id = 0
  181.       end
  182.       # 伤害
  183.       if @battler.damage_pop
  184.         damage(@battler.damage, @battler.critical)
  185.         @battler.damage = nil
  186.         @battler.critical = false
  187.         @battler.damage_pop = false
  188.       end
  189.       # korapusu★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  190.       if @battler.damage == nil and @battler.dead?
  191.         if @battler.is_a?(Game_Enemy)
  192.           $game_system.se_play($data_system.enemy_collapse_se)
  193.           @battler.startactive = "静态"
  194.         else
  195.           $game_system.se_play($data_system.actor_collapse_se)
  196.          @battler.startactive = "静态"
  197.         end
  198.         @battler_visible = false
  199.       end
  200.     end
  201. # 设置活动块的坐标
  202.     self.x = @battler.screen_x
  203.     self.y = @battler.screen_y
  204.     self.z = @battler.screen_z
  205.     [url=home.php?mod=space&uid=287812]@mx[/url] = self.bitmap.height
  206.     if @battler.is_a?(Game_Actor)
  207.         @sprite_contens.bitmap.clear
  208.         @sprite_contens.x = @battler.screen_x - 30
  209.         @sprite_contens.y = @battler.screen_y  - @mx -  20
  210.         @sprite_contens.z = self.z
  211.         draw_actor_name(@battler, 0,@mx)
  212.         draw_battle_hp(@battler, 0,0)
  213.       elsif @battler.is_a?(Game_Enemy)
  214.         @sprite_contens.bitmap.clear
  215.         @sprite_contens.x = @battler.screen_x - 30
  216.         @sprite_contens.y = @battler.screen_y - 20
  217.         draw_actor_name(@battler, 0, 0)
  218.       end
  219.    end
  220.    end




战斗结束后,角色名字和血条的清除,在线等回答。如果需要其他的脚本,请说下。

Lv3.寻梦者

梦石
0
星屑
1556
在线时间
626 小时
注册时间
2010-8-5
帖子
451
2
 楼主| 发表于 2013-8-16 09:23:44 | 只看该作者
这是要沉???{:2_259:}
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-29 19:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表