Project1

标题: 谁可幇制作轮盘式血槽系统? [打印本页]

作者: knlau    时间: 2013-1-26 21:13
标题: 谁可幇制作轮盘式血槽系统?
如题: 小弟制作中的游戏需要以轮盘式血槽来显示HP, MP和TP,便于增減hp值等等... 这样显示会比较好。
它的特点是当你受到致命伤害时你不会立即死亡,轮盘是会不断下降直到HP下降到0的时候你才会死亡。
有谁懂得写伤害数值显示的可以幇做一个轮盘式血槽系统吗? thx~

跟earthbound的一样或者是其他轮盘式血槽都可以。


作者: zhangbanxian    时间: 2013-1-26 21:13
写完领奖- -b
http://rpg.blue/thread-281095-1-1.html
作者: 774741359    时间: 2013-1-26 21:16
有心无力,坐等好心人。我去试试。
作者: 1396    时间: 2013-1-31 16:10
轮盘式血槽(放在mian前面):

#转轮血条
#章半仙制作
module RollBar
ROLL_UNIT = 1       #每次转轮扣的血
ROLL_TIME = 0.05    #每次转轮花的秒数
DEFAULT_SYS= false  #如果是默认系统设为true会略微提升一点效率- -b
VERSION = 0.92
end
class Game_Actor
include RollBar
def hp=(hp)
    fucker_hp = [[hp, mhp].min, 0].max - @hp
    rec = fucker_hp > 0
    Thread.new do
     (fucker_hp / ROLL_UNIT).truncate.abs.times do
       rec ? @hp = [@hp + ROLL_UNIT, mhp].min  : @hp = [@hp - ROLL_UNIT, 0].max
       refresh
       sleep(ROLL_TIME)
      end
    end
end
def mp=(mp)
    fucker_mp = [[mp, mmp].min, 0].max - @mp
    rec = fucker_mp > 0
    Thread.new do
     (fucker_mp  / ROLL_UNIT).truncate.abs.times do
       rec ? @mp = [@mp + ROLL_UNIT, mmp].min : @mp = [@mp - ROLL_UNIT, 0].max
       refresh
       sleep(ROLL_TIME)
      end
    end
end
def tp=(tp)
    fucker_tp = [[tp, max_tp].min, 0].max - @tp
    rec = fucker_tp > 0
    Thread.new do
     (fucker_tp / ROLL_UNIT).truncate.abs.times do
       rec ? @tp = [@tp + ROLL_UNIT, max_tp].min : @tp = [@tp - ROLL_UNIT, 0].max
       sleep(ROLL_TIME)
      end
    end
  end
  alias fucker_clear_actions clear_actions
  def clear_actions
    fucker_clear_actions
    @actions.push Game_Action.new(self)
  end
end
class Window_Base
  include RollBar
  alias fucker_draw_actor_hp draw_actor_hp
  alias fucker_draw_actor_mp draw_actor_mp
  alias fucker_draw_actor_tp draw_actor_tp
  alias fucker_dispose dispose
  def draw_actor_hp(actor, x, y, width = 124)
    reg_window
    unless DEFAULT_SYS
     @hp_need_refresh.each_key do |i|
      @hp_need_refresh.delete(i) if i[1] == x && i[2] == y
     end
    end
    fucker_draw_actor_hp(actor, x, y, width)
  end
  def draw_actor_mp(actor, x, y, width = 124)
    reg_window
    unless DEFAULT_SYS
      @mp_need_refresh.each_key do |i|
       @mp_need_refresh.delete(i) if i[1] == x && i[2] == y
      end
    end
    fucker_draw_actor_mp(actor, x, y, width)
  end
  def draw_actor_tp(actor, x, y, width = 124)
    reg_window
    unless DEFAULT_SYS
      @tp_need_refresh.each_key do |i|
       @tp_need_refresh.delete(i) if i[1] == x && i[2] == y
      end
    end
    fucker_draw_actor_tp(actor, x, y, width)
  end
  def dispose
    unreg_window
    fucker_dispose
  end
  def reg_window
    unless @reg
      @reg = true     
      Graphics.reg_window(self)
      return if DEFAULT_SYS
      @hp_need_refresh = {}
      @mp_need_refresh = {}
      @tp_need_refresh = {}
      class << self
        def roll_bar_refresh
          @hp_need_refresh.each_pair do |p,v|
           next if p[0].hp == v
           contents.clear_rect(p[1], p[2], p[3], line_height)
           fucker_draw_actor_hp(*p)
          end
          @mp_need_refresh.each_pair do |p,v|
           next if p[0].mp == v
           contents.clear_rect(p[1], p[2], p[3], line_height)
           fucker_draw_actor_mp(*p)   
          end
          @tp_need_refresh.each_pair do |p,v|
           next if p[0].tp == v
           contents.clear_rect(p[1], p[2], p[3], line_height)
           fucker_draw_actor_tp(*p)
         end
        end
        def fucker_draw_actor_hp(*args)
          @hp_need_refresh[args] = args[0].hp
          #super
          self.class.instance_method(:fucker_draw_actor_hp).bind(self).call(*args)
        end
        def fucker_draw_actor_mp(*args)        
          @mp_need_refresh[args] = args[0].mp
          #super
          self.class.instance_method(:fucker_draw_actor_mp).bind(self).call(*args)
        end   
        def fucker_draw_actor_tp(*args)
          @tp_need_refresh[args] = args[0].tp
          #super
          self.class.instance_method(:fucker_draw_actor_tp).bind(self).call(*args)
        end
      end
    end
  end
  def unreg_window
    @reg = false
    Graphics.unreg_window(self)
  end
end
class << Graphics
  alias fucker_update update
  def reg_window(window)
    @need_refresh ||= []
    @need_refresh.push window unless @need_refresh.include? window
  end
  def unreg_window(window)
    @need_refresh.delete window if @need_refresh.is_a? Array
  end
  def update
    fucker_update   
    unless @need_refresh.nil?
     for i in @need_refresh
       i.roll_bar_refresh if i.visible
     end
    end
  end
end
if RollBar::DEFAULT_SYS
#以下解决效率问题,可能会造成冲突- -b
class Window_BattleStatus
  def roll_bar_refresh
    for i in 0...$game_party.battle_members.size
      actor = $game_party.battle_members
      x = gauge_area_rect(i).x
      y = gauge_area_rect(i).y
      height = line_height
      @fucker_hp ||= []
      if @fucker_hp != actor.hp
         contents.clear_rect(x, y, 72, height)
         draw_actor_hp(actor, x, y,72)
         @fucker_hp = actor.hp
       end
      @fucker_mp ||= []
      if @fucker_mp != actor.mp
         contents.clear_rect(x + 82, y, 64, height)
         draw_actor_mp(actor, x + 82, y, 64)
         @fucker_mp = actor.mp
       end   
      @fucker_tp ||= []
      if @fucker_tp != actor.tp
         contents.clear_rect( x + 156, y, 64, height)
         draw_actor_tp(actor, x + 156, y, 64)
         @fucker_tp = actor.tp
      end        
    end
  end
end
class Window_MenuStatus
  def roll_bar_refresh
    for i in 0...$game_party.battle_members.size
      actor = $game_party.battle_members
       x = item_rect(i).x  + 108 + 120
       y = item_rect(i).y + line_height / 2
       width = 124
       height = line_height
       @fucker_hp ||= []
       if @fucker_hp != actor.hp
         contents.clear_rect(x, y + line_height, width, height)
         draw_actor_hp(actor, x, y + line_height)
         @fucker_hp = actor.hp
       end
       @fucker_mp ||= []
       if @fucker_mp != actor.mp
         contents.clear_rect(x, y + line_height * 2, width, height)
         draw_actor_mp(actor, x, y + line_height * 2)
         @fucker_mp = actor.mp
       end
    end
  end
end
class Window_SkillStatus
  def roll_bar_refresh
    x = 108 + 120
    y = line_height / 2
    width = 124
    height = line_height  
    if @fucker_hp != @actor.hp
      contents.clear_rect(x, y +  line_height, width, height)
      draw_actor_hp(@actor, x, y + line_height)
      @fucker_hp = @actor.hp
    end
    if @fucker_mp != @actor.mp
      contents.clear_rect(x, y + line_height * 2, width, height)
      draw_actor_mp(@actor, x, y + line_height * 2)
      @fucker_mp = @actor.mp
    end
  end
end
class Window_Status
  def roll_bar_refresh
    x = 136
    y = line_height * 3
    width = 124
    height = line_height
    if @fucker_hp != @actor.hp
      contents.clear_rect(x, y +  line_height, width, height)
      draw_actor_hp(@actor, x, y + line_height)
      @fucker_hp = @actor.hp
    end
    if @fucker_mp != @actor.mp
      contents.clear_rect(x, y + line_height * 2, width, height)
      draw_actor_mp(@actor, x, y + line_height * 2)
      @fucker_mp = @actor.mp
    end
  end
end
end

作者: j433463    时间: 2013-1-31 19:16
没玩过这种游戏,现在才知道轮盘式血槽的意思,不过好像数字都一样很慢,2楼的我调到 0.0001 也一样跟不上战斗速度,很久才会跑完,5楼也没比较快,是极限了吗?




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