VX 스크립트

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ 범용 게이지 묘화 - KGC_GenericGauge ◆ VX ◆
#_/    ◇ Last update : 2009/08/18 ◇
#_/----------------------------------------------------------------------------
#_/  범용적인 게이지 묘화 기능을 제공합니다.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ 커스터마이즈 항목 - Customize BEGIN ★
#==============================================================================

module KGC
module GenericGauge
  # ◆ 게이지 화상
  #  "Graphics/System" 로부터 읽어들인다.
  HP_IMAGE  = "GaugeHP"   # HP
  MP_IMAGE  = "GaugeMP"   # MP
  EXP_IMAGE = "GaugeEXP"  # EXP

  # ◆ 게이지 위치 보정 [x, y]
  HP_OFFSET  = [-23, -2]  # HP
  MP_OFFSET  = [-23, -2]  # MP
  EXP_OFFSET = [-23, -2]  # EXP

  # ◆ 게이지장 보정
  HP_LENGTH  = -4  # HP
  MP_LENGTH  = -4  # MP
  EXP_LENGTH = -4  # EXP

  # ◆ 게이지의 기울기 각도
  #  -89  89 로 지정.
  HP_SLOPE  = 30  # HP
  MP_SLOPE  = 30  # MP
  EXP_SLOPE = 30  # EXP
end
end

#==============================================================================
# ☆ 커스터마이즈 항목 종료 - Customize END ☆
#==============================================================================

$imported = {} if $imported == nil
$imported["GenericGauge"] = true

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Bitmap
#==============================================================================

unless $imported["BitmapExtension"]
class Bitmap
  #--------------------------------------------------------------------------
  # ○평행 사변형 전송
  #--------------------------------------------------------------------------
  def skew_blt(x, y, src_bitmap, src_rect, slope, opacity = 255)
    slope = [[slope, -90].max, 90].min
    sh    = src_rect.height
    off  = sh / Math.tan(Math::PI * (90 - slope.abs) / 180.0)
    if slope >= 0
      dx   = x + off.to_i
      diff = -off / sh
    else
      dx   = x
      diff = off / sh
    end
    rect = Rect.new(src_rect.x, src_rect.y, src_rect.width, 1)

    sh.times { |i|
      blt(dx + (diff * i).round, y + i, src_bitmap, rect, opacity)
      rect.y += 1
    }
  end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # 0차의 레벨의 경험치 취득
  #--------------------------------------------------------------------------
  def next_exp
    return @exp_list[@level+1]
  end
  #--------------------------------------------------------------------------
  # 0차의 레벨의 차분 경험치 취득
  #--------------------------------------------------------------------------
  def next_diff_exp
    return (@exp_list[@level+1] - @exp_list[@level])
  end
  #--------------------------------------------------------------------------
  # 0차의 레벨까지의 경험치 취득
  #--------------------------------------------------------------------------
  def next_rest_exp
    return (@exp_list[@level+1] - @exp)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window
  @@__gauge_buf = Bitmap.new(320, 24)
  #--------------------------------------------------------------------------
  # ○게이지 묘화
  #     file       : 게이지 화상 파일명
  #     x          : 묘화처 X 좌표
  #     y          : 묘화처 Y 좌표
  #     width      : 폭
  #     value      : 현재가
  #     limit      : 상한치
  #     offset     : 좌표 조정 [x, y]
  #     len_offset : 길이 조정
  #     slope      : 기울기
  #--------------------------------------------------------------------------
  def draw_gauge(file, x, y, width, value, limit, offset, len_offset, slope)
    img    = Cache.system(file)
    x     += offset[0]
    y     += offset[1]
    width += len_offset
    draw_gauge_base(img, x, y, width, slope)
    gw = width * value / limit
    draw_gauge_bar(img, x, y, width, gw, slope)
  end
  #--------------------------------------------------------------------------
  # ○게이지 베이스 묘화
  #     img   : 게이지 화상
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     width : 폭
  #     slope : 기울기
  #--------------------------------------------------------------------------
  def draw_gauge_base(img, x, y, width, slope)
    rect = Rect.new(0, 0, 24, 24)
    if slope != 0
      self.contents.skew_blt(x, y, img, rect, slope)
      rect.x = 96
      self.contents.skew_blt(x + width + 24, y, img, rect, slope)

      rect.x     = 24
      rect.width = 72
      dest_rect = Rect.new(0, 0, width, 24)
      @@__gauge_buf.clear
      @@__gauge_buf.stretch_blt(dest_rect, img, rect)
      self.contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
    else
      self.contents.blt(x, y, img, rect)
      rect.x = 96
      self.contents.blt(x + width + 24, y, img, rect)
      rect.x     = 24
      rect.width = 72
      dest_rect = Rect.new(x + 24, y, width, 24)
      self.contents.stretch_blt(dest_rect, img, rect)
    end
  end
  #--------------------------------------------------------------------------
  # ○게이지 내부 묘화
  #     img   : 게이지 화상
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     width : 전체폭
  #     gw    : 내부폭
  #     slope : 기울기
  #--------------------------------------------------------------------------
  def draw_gauge_bar(img, x, y, width, gw, slope)
    rect = Rect.new(0, 24, 72, 24)
    dest_rect = Rect.new(0, 0, width, 24)
    @@__gauge_buf.clear
    @@__gauge_buf.stretch_blt(dest_rect, img, rect)
    dest_rect.width = gw
    if slope != 0
      self.contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
    else
      self.contents.blt(x + 24, y, @@__gauge_buf, dest_rect)
    end
  end
  #--------------------------------------------------------------------------
  # ● HP 게이지의 묘화
  #     actor : 액터
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     width : 폭
  #--------------------------------------------------------------------------
  def draw_actor_hp_gauge(actor, x, y, width = 120)
    draw_gauge(KGC::GenericGauge::HP_IMAGE,
      x, y, width, actor.hp, actor.maxhp,
      KGC::GenericGauge::HP_OFFSET,
      KGC::GenericGauge::HP_LENGTH,
      KGC::GenericGauge::HP_SLOPE)
  end
  #--------------------------------------------------------------------------
  # ● MP 게이지의 묘화
  #     actor : 액터
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     width : 폭
  #--------------------------------------------------------------------------
  def draw_actor_mp_gauge(actor, x, y, width = 120)
    draw_gauge(KGC::GenericGauge::MP_IMAGE,
      x, y, width, actor.mp, [actor.maxmp, 1].max,
      KGC::GenericGauge::MP_OFFSET,
      KGC::GenericGauge::MP_LENGTH,
      KGC::GenericGauge::MP_SLOPE)
  end
  #--------------------------------------------------------------------------
  # ○ Exp 의 묘화
  #     actor : 액터
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     width : 폭
  #--------------------------------------------------------------------------
  def draw_actor_exp(actor, x, y, width = 180)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width, WLH, actor.exp_s, 2)
  end
#--------------------------------------------------------------------------
  # ○ NextExp 의 묘화
  #     actor : 액터
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     width : 폭
  #--------------------------------------------------------------------------
  def draw_actor_next_exp(actor, x, y, width = 180)
    draw_actor_exp_gauge(actor, x, y, width)

    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width, WLH, actor.next_rest_exp_s, 2)
  end
  #--------------------------------------------------------------------------
  # ○ Exp 게이지의 묘화
  #     actor : 액터
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     width : 폭
  #--------------------------------------------------------------------------
  def draw_actor_exp_gauge(actor, x, y, width = 180)
    diff = [actor.next_diff_exp, 1].max
    rest = [actor.next_rest_exp, 1].max
    draw_gauge(KGC::GenericGauge::EXP_IMAGE,
      x, y, width, diff - rest, diff,
      KGC::GenericGauge::EXP_OFFSET,
      KGC::GenericGauge::EXP_LENGTH,
      KGC::GenericGauge::EXP_SLOPE)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Status
#==============================================================================

class Window_Status < Window_Base
  #--------------------------------------------------------------------------
  # ● 경험치 정보의 묘화
  #     x : 묘화처 X 좌표
  #     y : 묘화처 Y 좌표
  #--------------------------------------------------------------------------
  def draw_exp_info(x, y)
    s_next = sprintf(Vocab::ExpNext, Vocab::level)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
    self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
    draw_actor_exp(@actor, x, y + WLH * 1)
    draw_actor_next_exp(@actor, x, y + WLH * 3)
  end
end

 

 

-------------------------사용법------------------------------------------------------------------------------------------------------------------

# ◆ 게이지 화상
#  "Graphics/System" 로부터 읽어들인다.
HP_IMAGE  = "GaugeHP"   # HP
MP_IMAGE  = "GaugeMP"   # MP
EXP_IMAGE = "GaugeEXP"  # EXP
각 게이지 화상의 파일명을 지정합니다.
화상은 "Graphics/System" 에 보존해 주세요.

--------------------------------------------------------------------------------

# ◆ 게이지 위치 보정 [x, y]
HP_OFFSET  = [-23, -2]  # HP
MP_OFFSET  = [-23, -2]  # MP
EXP_OFFSET = [-23, -2]  # EXP
게이지의 묘화 위치를 어느 정도 늦추는지를 지정합니다.
게이지 화상을 변경했을 때는, 이쪽을 조정해 주세요.

--------------------------------------------------------------------------------

# ◆ 게이지장 보정
HP_LENGTH  = -4  # HP
MP_LENGTH  = -4  # MP
EXP_LENGTH = -4  # EXP
게이지의 길이를 어느 정도 늘리는지를 지정합니다.
게이지 화상을 변경했을 때는, 이쪽을 조정해 주세요.

--------------------------------------------------------------------------------

# ◆ 게이지의 기울기 각도
HP_SLOPE  = 30  # HP
MP_SLOPE  = 30  # MP
EXP_SLOPE = 30  # EXP
게이지 화상의 기울기 각도를 89  -89의 범위에서 지정합니다.
각도는 윗방향을 0으로서 우측이 플러스, 좌측이 마이너스가 됩니다.
플러스의 경우는 게이지 하단, 마이너스의 경우는 게이지 상단이 묘화시의 기준 위치가 됩니다.

HPGaugeHP.png

MPGaugeMP.png

EXPGaugeEXP.png

   generic_gauge01.jpg

TAG •

Who's 카르와푸딩의아틀리에

profile

엘카르디아 제작자 (현재 MV로 리메이크중)

유튜브

https://www.youtube.com/channel/UCMwirNTR-pOEzJNB0jL3y_g

트위터

https://twitter.com/karsis98

블로그

https://blog.naver.com/karsis98

Comment '14'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
417 전투 불사신(무적) 스크립트 9 file 미얼 2009.10.29 3198
416 이동 및 탈것 부드럽게 이동, 8 방향이동 스크립트 25 file 사람이라면? 2010.08.16 3795
415 상점 보관함 스크립트 43 file 허걱 2009.02.02 5161
414 HUD 변수 표시 HUD 8 Tofuman 2009.02.15 2469
413 베틀 스크린 톤 체인지?? 무슨 말? 4 Man... 2008.10.28 1616
» 기타 범용 게이지 묘화 - KGC 14 file 카르와푸딩의아틀리에 2009.08.19 3476
411 배틀할때 몬스터의 HP표시 !! 5 file 미카엘 2008.08.17 7517
410 기타 배틀신에서 곡 넘기기 2 rukan 2009.07.02 1757
409 전투 방패가없어? 그럼 방어못하게하는 스크립트. 16 file 할렘 2009.02.07 3425
408 전투 방어를 했을경우 hp / mp 회복 되도록 하는 스크립트 15 아방스 2008.01.22 3746
407 장비 방어구 착용시 최대HP, MP증가 스크립트(턴알) 3 file 기관차 2014.11.06 1222
406 기타 밤낮의 변화에 따른 전투배경의 변화 스크립트 10 file 카르와푸딩의아틀리에 2009.07.01 2948
405 그래픽 밤낮 변환 스크립트 18 kram3 2008.01.31 3762
404 그래픽 밤낮 변환 VX용 26 독도2005 2008.03.23 4314
403 스킬 발상의전환 : 스킬과 아이템의 공격횟수를 동시에 증가시키기 14 star211 2010.02.16 3179
402 전투 반사 스테이트 -KGC 4 카르와푸딩의아틀리에 2009.09.12 2661
401 스킬 미완성 구버전. 2칸 위에 있는 글을 이용해주세요. 7 Last H 2009.02.23 1925
400 미니맵 미니맵 스크립트(아랫거랑 다른거) 75 file 츠키아 2008.08.08 6145
399 미니맵 미니맵 띠우는 스크립트 ^^ 37 file 아방스 2008.06.02 7247
398 기타 미니게임테트리스 스크립트 ㅋㅋㅋ 27 file 카르와푸딩의아틀리에 2009.06.30 3689
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ... 32 Next
/ 32