Project1

标题: ARPG问题:如何在界面上显示EXP经验值? [打印本页]

作者: fybtgame    时间: 2008-5-8 20:19
提示: 作者被禁止或删除 内容自动屏蔽
作者: 9244579    时间: 2008-5-8 20:25
那你想以什么方式显示呢
文字 还是 图形?
作者: 劍之飛龍☆    时间: 2008-5-8 20:27
如果你有能力,可以通过事件来做。

作者: 9244579    时间: 2008-5-8 20:50
  1. class Window_Exp < Window_Base
  2.   def initialize
  3.     super(0, 0, 160, 64)
  4.     self.contents = Bitmap.new(width - 32, height - 32)
  5.     refresh
  6.   end
  7.   def refresh
  8.     self.contents.clear
  9.       for i in 0...$game_party.actors.size
  10.       x = 64
  11.       y = i * 116
  12.       actor = $game_party.actors[1]
  13.        exp(actor,0,0)
  14.     end
  15.   end
  16.   def exp(actor,x,y)
  17.     self.contents.fill_rect(x,y,96,16,Color.new(255,255,255,255))
  18.     self.contents.fill_rect(x+1,y+1,94,14,Color.new(0,0,0,255))
  19.     w = 94*$game_actors[1].now_exp/$game_actors[1].next_exp
  20.     self.contents.fill_rect(x+1,y+1,w,14,Color.new(50,255,50,255))
  21.   end
  22. end
  23. class Scene_Map
  24.   def initialize
  25.     @o_exp = $game_actors[1].exp
  26.   end
  27.   alias old_main main
  28.   def main
  29.     @exp = Window_Exp.new
  30.     @exp.x = 0
  31.     @exp.y = 0
  32.     old_main
  33.     @exp.dispose
  34.   end
  35.   alias old_update update
  36.   def update
  37.     if @o_exp != $game_actors[1].exp
  38.       @o_exp = $game_actors[1].exp
  39.       @exp.refresh
  40.     else
  41.       @exp.update
  42.     end
  43.     old_update
  44.   end
  45. end
  46. class Game_Actor
  47.   def now_exp
  48.     return @exp - @exp_list[@level]
  49.   end
  50.   def next_exp
  51.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  52.   end
  53. end
复制代码

这个是我自己工程里弄一段下来给你参考的
直接把脚本复制放到main前就可以``
就是经验条了`
自己可以修改添加
作者: fybtgame    时间: 2008-5-9 02:18
提示: 作者被禁止或删除 内容自动屏蔽
作者: 9244579    时间: 2008-5-9 05:01
class Window_Exp < Window_Base
def initialize
   super(0, 0, 160, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
end
def refresh
   self.contents.clear
     for i in 0...$game_party.actors.size
     x = 64
     y = i * 116
     actor = $game_party.actors[1]
      exp(actor,0,0)
   end
end
def exp(actor,x,y)
   self.contents.fill_rect(x,y,96,16,Color.new(255,255,255,255))
   self.contents.fill_rect(x+1,y+1,94,14,Color.new(0,0,0,255))
   w = 94*$game_actors[1].now_exp/$game_actors[1].next_exp
   self.contents.fill_rect(x+1,y+1,w,14,Color.new(50,255,50,255))
end
end
class Scene_Map
def initialize
   @o_exp = $game_actors[1].exp
end
alias old_main main
def main
   @exp = Window_Exp.new
   @exp.x = 0
   @exp.y = 0
   @exp.opacity = 0 # 255可见 0不可见
   
old_main
   @exp.dispose
end
alias old_update update
def update
   if @o_exp != $game_actors[1].exp
     @o_exp = $game_actors[1].exp
     @exp.refresh
   else
     @exp.update
   end
   old_update
end
end
class Game_Actor
def now_exp
   return @exp - @exp_list[@level]
end
def next_exp
   return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end


作者: fybtgame    时间: 2008-5-10 09:16
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1