XP 스크립트

전투시 대미지를 FF10 스타일로 표시하는 스크립트입니다.


#==============================================================================
# ■ RPG::Sprite
#------------------------------------------------------------------------------
# Change the damage display
#
# By Squall // squall@rmxp.ch
# released on the 30th march at rmxp.org
#==============================================================================

class RPG::Sprite < ::Sprite
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(viewport = nil)
    super(viewport)
    @_whiten_duration = 0
    @_appear_duration = 0
    @_escape_duration = 0
    @_collapse_duration = 0
    @_damage_durations = []
    @_animation_duration = 0
    @_blink = false
  end
  #--------------------------------------------------------------------------
  # ● dispose
  #--------------------------------------------------------------------------
  def dispose
    dispose_damage(0...@_damage_durations.size)
    dispose_animation
    dispose_loop_animation
    super
  end
  #--------------------------------------------------------------------------
  # ● effect?
  #--------------------------------------------------------------------------
  def effect?
    damage_duration = 0
    for value in @_damage_durations
      damage_duration += value
    end
    @_whiten_duration > 0 or
    @_appear_duration > 0 or
    @_escape_duration > 0 or
    @_collapse_duration > 0 or
    damage_duration > 0 or
    @_animation_duration > 0
  end
  #--------------------------------------------------------------------------
  # ● damage
  #--------------------------------------------------------------------------
  def damage(value, critical)
    dispose_damage(0...@_damage_durations.size)
    @_damage_sprites = []
    if value.is_a?(Numeric)
      damage_string = value.abs.to_s
    else
      damage_string = value.to_s
    end
    if critical
      damage_string += " CRITICAL"
    end
     
    for i in 0...damage_string.size
      letter = damage_string[i..i]
      bitmap = Bitmap.new(48, 48)
      bitmap.font.size = 24
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 48, 48, letter, 1)
      bitmap.draw_text(+1, 12-1, 48, 48, letter, 1)
      bitmap.draw_text(-1, 12+1, 48, 48, letter, 1)
      bitmap.draw_text(+1, 12+1, 48, 48, letter, 1)
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, 48, 48, letter, 1)
     
      @_damage_sprites[i] = ::Sprite.new(self.viewport)
      @_damage_sprites[i].bitmap = bitmap
      @_damage_sprites[i].visible = false
      @_damage_sprites[i].ox = 16
      @_damage_sprites[i].oy = 16
      @_damage_sprites[i].x = self.x - self.ox / 2 + i * 12
      @_damage_sprites[i].y = self.y - self.oy / 2
      @_damage_sprites[i].z = 3000
      @_damage_durations[i] = 40 + i * 2
    end
  end
  #--------------------------------------------------------------------------
  # ● dispose_damage
  #--------------------------------------------------------------------------
  def dispose_damage(index)
    return if @_damage_sprites == nil
    if @_damage_sprites[index].is_a?(::Sprite) and @_damage_sprites[index].bitmap != nil
      @_damage_sprites[index].bitmap.dispose
      @_damage_sprites[index].dispose
      @_damage_durations[index] = 0
    end
  end
  #--------------------------------------------------------------------------
  # ● update
  #--------------------------------------------------------------------------
  def update
    super
    if @_whiten_duration > 0
      @_whiten_duration -= 1
      self.color.alpha = 128 - (16 - @_whiten_duration) * 10
    end
    if @_appear_duration > 0
      @_appear_duration -= 1
      self.opacity = (16 - @_appear_duration) * 16
    end
    if @_escape_duration > 0
      @_escape_duration -= 1
      self.opacity = 256 - (32 - @_escape_duration) * 10
    end
    if @_collapse_duration > 0
      @_collapse_duration -= 1
      self.opacity = 256 - (48 - @_collapse_duration) * 6
    end
    for i in 0...@_damage_durations.size
      damage_sprite = @_damage_sprites[i]
      next if @_damage_durations[i] == nil
      if @_damage_durations[i] > 0
        @_damage_durations[i] -= 1
        damage_sprite.visible = (@_damage_durations[i] <= 40)
        case @_damage_durations[i]
        when 38..39
          damage_sprite.y -= 4
        when 36..37
          damage_sprite.y -= 2
        when 34..35
          damage_sprite.y += 2
        when 28..33
          damage_sprite.y += 4
        end
        damage_sprite.opacity = 256 - (12 - @_damage_durations[i]) * 32
        if @_damage_durations[i] == 0
          dispose_damage(i)
        end
      end
    end
    if @_animation != nil and (Graphics.frame_count % 2 == 0)
      @_animation_duration -= 1
      update_animation
    end
    if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
      update_loop_animation
      @_loop_animation_index += 1
      @_loop_animation_index %= @_loop_animation.frame_max
    end
    if @_blink
      @_blink_count = (@_blink_count + 1) % 32
      if @_blink_count < 16
        alpha = (16 - @_blink_count) * 6
      else
        alpha = (@_blink_count - 16) * 6
      end
      self.color.set(255, 255, 255, alpha)
    end
    @@_animations.clear
  end
end

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
161 영상 berka's Video Script II Reloaded 1.2 2 Alkaid 2010.10.08 1400
160 영상 The AVI Player 1.3 by DerVVulfman 3 Alkaid 2010.10.08 1707
159 기타 [맵 아이디 확인 스크립트] 맵아이디 모르는 사람을 위한 스크립트 9 file 코아 코스튬 2010.10.09 2161
158 기타 현재시간표시 33 file 코아 코스튬 2010.10.09 2528
157 저장 Improved Save by gerrtunk 2 file Alkaid 2010.10.13 1983
156 전투 Minkoff's Animated Battlers - Enhanced 13.3 by DerVVulfman file Alkaid 2010.10.14 1646
155 전투 CTB by Charlie Fleed 3.2 - FF10 스타일의 전투 시스템 7 Alkaid 2010.10.14 3449
154 온라인 ORPG 여러분이 원하는 온라인 스크립트 한글화해서 다시 배포! 20 file 심영 2010.10.16 5573
153 영상 플래시 파일 재생 스크립트. 4 Bera 2010.10.16 2097
152 Run-Smoother! ( 렉 줄이는 스크립트 ) 12 file Bera 2010.10.16 2295
151 이동 및 탈것 멈췄을때 행동. 17 file Bera 2010.10.17 3408
150 키입력 메세지 입력 스크립트. 25 file Bera 2010.10.18 3582
149 HUD [게이지바]2.0버젼「체력,마나,경험치,직업,캐릭터,레벨,돈,맵이름」(HelloCoa2Ver2.0) 67 file 코아 코스튬 2010.10.23 5553
148 메뉴 [메뉴] 간단한 형식의 CoaMenu2Scroll 버젼 20 file 코아 코스튬 2010.10.24 3526
147 [복권] 복권시스템 2.0 [수정 완료] 12 file 코아 코스튬 2010.10.26 1860
146 [복권] 복권시스템2번째탄 순위 버젼입니다. 13 file 코아 코스튬 2010.10.28 2533
145 온라인 NetPlay Evolution v3 여러분이 고대하시던 NPE v3입니다! 5 file 심영 2010.10.29 3993
144 HUD [게이지바]3.0버젼「현재시간, 플레이시간, 걸음수, 윈도우 이동 추가」(HelloCoa2Ver3.0) 63 file 코아 코스튬 2010.10.30 4921
143 영상 플래시 동영상 재생 스크립트 사용법 및 다운로드 8 아방스 2010.11.02 3919
142 기타 [회복] 대기 회복 스크립트4.0 여러 오류 문제 해결 및 길이 줄임 11 file 코아 코스튬 2010.11.06 2189
Board Pagination Prev 1 ... 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 Next
/ 52