Raccoon Game RPG รวมพลนักพัฒนา

[สคริปต์] Vixotic's Damage Popup

Go down

[สคริปต์] Vixotic's Damage Popup

ตั้งหัวข้อ by boyhit on Mon Oct 31, 2011 5:58 am

Vixotic's Damage Popup
Exclusive Script for Rpgmakervx.net
Version: 1.0
Released on: 09/02/2008



.:Screenshot:.



.:Script:.
ใส่ไว้เหนือ Main
CODE
#=======================================================================

=======
# <<\/>> Vixotic_Damage_Pop up
#------------------------------------------------------------------------------
# Version 1.1
# by Vixotic [vixotic@live.com]
# Exclusive Script for http://rpgmakervx.net/
#
# Place this script above Main
#=======================================================================

=======

module VIX
#--------------------------
# Damage Text Position
#------------------------
Damage_X_Plus = 0
# Move Damage Position in vertical direction ((-)up <= 0 => down(+))

Damage_Y_Plus = -20
# Move Damage Position in horizontal direction ((-)left <= 0 => right(+))

#--------------------------
# Damage Text Font/Size
#------------------------
Damage_Text_Font = "Arial Black"
Damage_Text_Size = 32
end

class Sprite_Base < Sprite
alias vix_sprbase_ini initialize
alias vix_sprbase_upd update

def initialize(viewport = nil)
vix_sprbase_ini(viewport)
@_damage_duration = 0
end

def update
vix_sprbase_upd
if @_damage_duration > 0
@_damage_duration -= 1
case @_damage_duration
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_duration) * 32
if @_damage_duration == 0
dispose_damage
end
end
end


def damage(value)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = VIX::Damage_Text_Font
bitmap.font.size = VIX::Damage_Text_Size
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 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, 160, 36, damage_string, 1)
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x + VIX::Damage_X_Plus
@_damage_sprite.y = (self.y - self.oy / 2) + VIX::Damage_Y_Plus
@_damage_sprite.z = 3000
@_damage_duration = 40
end

def dispose_damage
if @_damage_sprite != nil
@_damage_sprite.bitmap.dispose
@_damage_sprite.dispose
@_damage_sprite = nil
@_damage_duration = 0
end
end

end

class Game_Battler
attr_accessor :damage

alias vix_gamebat_clr clear_sprite_effects
def clear_sprite_effects
@damage = 0
vix_gamebat_clr
end

end

class Sprite_Battler < Sprite_Base
DAMAGE = 7

alias vix_sprbat_set setup_new_effect
def setup_new_effect
vix_sprbat_set
if @battler.damage != 0
damage(@battler.damage)
@effect_type = DAMAGE
@battler.damage = 0
end
end

end

class Scene_Battle < Scene_Base

def display_action_effects(target, obj = nil)
unless target.skipped
line_number = @message_window.line_number
wait(5)
target.damage = target.hp_damage if target.is_a?(Game_Enemy)
display_critical(target, obj)
display_damage(target, obj)
display_state_changes(target, obj)
if line_number == @message_window.line_number
display_failure(target, obj) unless target.states_active?
end
if line_number != @message_window.line_number
wait(30)
end
@message_window.back_to(line_number)
end
end
end

เครดิต วอราม่อน




avatar
boyhit
Admin
Admin

ชื่อเล่น : เเอล
ความฝัน : ศิลปิน
จำนวนข้อความ : 1130
เครดิต : 3356
วันที่สมัคร : 09/10/2011
คะเเนนน้ำใจ : 11
เพศ : Male อายุ : 19
เหรียญรางวัล :

ดูข้อมูลส่วนตัว http://raccoongame-rpg.thai-forum.net

ขึ้นไปข้างบน Go down

ขึ้นไปข้างบน


 
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ