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

Project1

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

怎么现血条?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
75
在线时间
12 小时
注册时间
2008-8-1
帖子
122
跳转到指定楼层
1
发表于 2008-8-3 03:01:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RT,敌我双芳抵押套,脚本的话改高了再給我,我脚本白痴
此贴于 2008-8-5 7:15:38 被版主darkten提醒,请楼主看到后对本贴做出回应。
版务信息:版主帮忙结贴~
踏浪

Lv2.观梦者

梦石
0
星屑
787
在线时间
109 小时
注册时间
2008-2-10
帖子
254
2
发表于 2008-8-3 03:16:42 | 只看该作者
  1. class Window_Base < Window  
  2.   #--------------------------------------------------------------------------
  3.   # * Draw Slant Bar
  4.   #--------------------------------------------------------------------------
  5.   def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  6.       bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  7.     # Draw Border
  8.     for i in 0..height
  9.       self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
  10.     end
  11.     # Draw Background
  12.     for i in 1..(height - 1)
  13.       r = 100 * (height - i) / height + 0 * i / height
  14.       g = 100 * (height - i) / height + 0 * i / height
  15.       b = 100 * (height - i) / height + 0 * i / height
  16.       a = 255 * (height - i) / height + 255 * i / height
  17.       self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
  18.     end
  19.     # Draws Bar
  20.     for i in 1..( (min / max.to_f) * width - 1)
  21.       for j in 1..(height - 1)
  22.         r = bar_color.red * (width - i) / width + end_color.red * i / width
  23.         g = bar_color.green * (width - i) / width + end_color.green * i / width
  24.         b = bar_color.blue * (width - i) / width + end_color.blue * i / width
  25.         a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
  26.         self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  27.       end
  28.     end
  29.   end
  30. end


  31. class Window_EnemyHP < Window_Base
  32.   
  33.   def initialize
  34.     super(0, 0, 640, 480)
  35.     self.contents = Bitmap.new(width - 32, height - 32)
  36.     self.opacity = 0
  37.     refresh
  38.   end
  39.   
  40.   def refresh
  41.     self.contents.clear
  42.     for i in 0...$game_troop.enemies.size
  43.       @enemy = $game_troop.enemies[i]
  44.       @percent = (@enemy.hp * 100) / @enemy.maxhp
  45.       unless @enemy.hp == 0
  46.       draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  47.       self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
  48.     end
  49.   end
  50. end
  51. end

  52. class Scene_Battle
  53.   
  54.   alias raz_update update
  55.   alias raz_update_phase5 update_phase5
  56.   alias raz_update_phase4_step1 update_phase4_step1
  57.   alias raz_update_phase4_step5 update_phase4_step5
  58.   alias raz_enemy_hp_main main
  59.   
  60.    def main
  61.     @troop_id = $game_temp.battle_troop_id
  62.     $game_troop.setup(@troop_id)
  63.     @enemy_window = Window_EnemyHP.new
  64.     @enemy_window.z = 95
  65.     raz_enemy_hp_main
  66.     @enemy_window.dispose
  67.   end

  68.   
  69.   def update
  70.     @enemy_window.update
  71.     raz_update
  72.   end

  73.   def update_phase5
  74.     # If wait count is larger than 0
  75.     if @phase5_wait_count > 0
  76.       # Decrease wait count
  77.       @phase5_wait_count -= 1
  78.       # If wait count reaches 0
  79.       if @phase5_wait_count == 0
  80.         @enemy_window.visible = false
  81.         # Show result window
  82.         @result_window.visible = true
  83.         # Clear main phase flag
  84.         $game_temp.battle_main_phase = false
  85.         # Refresh status window
  86.         @status_window.refresh
  87.         @enemy_window.refresh
  88.       end
  89.       return
  90.     end
  91.    raz_update_phase5
  92. end

  93. def update_phase4_step1
  94.   raz_update_phase4_step1
  95.   @enemy_window.refresh
  96. end

  97.   def update_phase4_step5
  98.     # Hide help window
  99.     @help_window.visible = false
  100.     # Refresh status window
  101.     @status_window.refresh
  102.     @enemy_window.refresh
  103.     raz_update_phase4_step5
  104.   end
  105. end

  106. class Window_BattleStatus < Window_Base
  107.   #--------------------------------------------------------------------------
  108.   # * Object Initialization
  109.   #--------------------------------------------------------------------------
  110.   def initialize
  111.     super(0, 320, 640, 160)
  112.     self.contents = Bitmap.new(width - 32, height - 32)
  113.     self.opacity = 0
  114.     @level_up_flags = [false, false, false, false]
  115.     refresh
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # * Dispose
  119.   #--------------------------------------------------------------------------
  120.   def dispose
  121.     super
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # * Set Level Up Flag
  125.   #     actor_index : actor index
  126.   #--------------------------------------------------------------------------
  127.   def level_up(actor_index)
  128.     @level_up_flags[actor_index] = true
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # * Refresh
  132.   #--------------------------------------------------------------------------
  133.   def refresh
  134.     self.contents.clear
  135.     @item_max = $game_party.actors.size
  136.     for i in 0...$game_party.actors.size
  137.       actor = $game_party.actors[i]
  138.       actor_x = i * 160 + 4
  139.       draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
  140.       draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
  141.       draw_actor_name(actor, actor_x, 0)
  142.       draw_actor_hp(actor, actor_x, 32, 120)
  143.       draw_actor_sp(actor, actor_x, 64, 120)
  144.       if @level_up_flags[i]
  145.         self.contents.font.color = normal_color
  146.         self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
  147.       else
  148.         draw_actor_state(actor, actor_x, 96)
  149.       end
  150.     end
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # * Frame Update
  154.   #--------------------------------------------------------------------------
  155.   def update
  156.     super
  157.     # Slightly lower opacity level during main phase
  158.     if $game_temp.battle_main_phase
  159.       self.contents_opacity -= 4 if self.contents_opacity > 191
  160.     else
  161.       self.contents_opacity += 4 if self.contents_opacity < 255
  162.     end
  163.   end
  164. end
复制代码


用这段代码就行了

系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~
h
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
75
在线时间
12 小时
注册时间
2008-8-1
帖子
122
3
 楼主| 发表于 2008-8-4 01:35:33 | 只看该作者
放在那里啊说清楚啊,是不是把Window_Base 里全删了换这代玛啊?
踏浪
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-3-30
帖子
537
4
发表于 2008-8-4 01:42:30 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-8-13 14:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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