| 赞 | 0  | 
 
| VIP | 30 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 16142 | 
 
| 最后登录 | 2019-4-26 | 
 
| 在线时间 | 317 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 60 
 
        - 在线时间
 - 317 小时
 
        - 注册时间
 - 2009-1-18
 
        - 帖子
 - 177
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
 本帖最后由 Majirefy 于 2010-9-15 23:26 编辑  
 
腳本如下: 
- # =============================================================================
 
 - # ** HP_Status
 
 - # -----------------------------------------------------------------------------
 
 - # This class performs a bar of current HP status on the top of screen.
 
 - # =============================================================================
 
  
- class HP_Status
 
 -   # ---------------------------------------------------------------------------
 
 -   # * Define contants of class
 
 -   # ---------------------------------------------------------------------------
 
 -   SWITCH = 1
 
 -   BACKGROUD_COLOR = Color.new(0, 0, 0, 255)
 
 -   TEXT_COLOR = Color.new(255, 255, 255, 255)
 
 -   FRAME_COLOR = Color.new(255, 255, 255, 255)
 
 -   BAR_COLOR = Color.new(255, 0, 0, 255)
 
 -   
 
 -   # ---------------------------------------------------------------------------
 
 -   # * Object Initialization
 
 -   # ---------------------------------------------------------------------------
 
 -   def initialize
 
 -     $bar = Sprite.new
 
 -     b = Bitmap.new(544, 24)
 
 -     $bar.bitmap = b
 
 -     if $game_switches[SWITCH]
 
 -       $bar.bitmap.clear
 
 -       $bar.bitmap.fill_rect(36, 10, 500, 24, FRAME_COLOR)
 
 -       $bar.bitmap.fill_rect(40, 12, 492, 20, BACKGROUD_COLOR)
 
 -       width = 492 * $game_actors[1].hp / $game_actors[1].maxhp
 
 -       #$bar.bitmap.fill_rect(40, 12, width, 20, BAR_COLOR)
 
 -       $bar.bitmap.draw_text(10, 12, 56, 24, "HP")
 
 -     end
 
 -   end
 
 - end
 
 
  复制代码 想在事件中調用這個,在事件腳本命令中寫入:HP_Bar = HP_Status.new,可顯示效果卻不盡人意,如下: 
 
 
 
不知道為甚麼不能完全顯示? 
 
還有以上的代碼是否有不妥的地方,希望指正批評。 
另外在事件中的調用方法正確麼?有甚麼更好的方法麼? 
謝謝大家。 
 
當然,這個是來自一個腳本腳程,萌芽那邊的。 
傳送門 
 
當然,希望有人幫忙看看遊戲工程文件:
 
En-Project-VX.rar
(229.28 KB, 下载次数: 23)
 
裡面竟然也不能運行。不知道我到底哪兒和腳程出入了。 
 
再次鞠躬謝謝大家。 |   
 
 
 
 |