Enable Usage of Rmxp 캐릭터(?)

by Man... posted Oct 28, 2008
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
class Game_Character
#--------------------------------------------------------------------------
# *initialize
#--------------------------------------------------------------------------
alias old_ini initialize
def initialize
old_ini
@original_pattern = 2
end
#--------------------------------------------------------------------------
# * strength
#--------------------------------------------------------------------------
def straighten
@pattern = 2 if @walk_anime or @step_anime
@anime_count = 0
end
end

class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Update Transfer Origin Bitmap
#--------------------------------------------------------------------------
def update_bitmap
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_index != @character.character_index
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_index = @character.character_index
if @tile_id > 0
sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
sy = @tile_id % 256 / 8 % 16 * 32;
self.bitmap = tileset_bitmap(@tile_id)
self.src_rect.set(sx, sy, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[!$#%]./]
if sign != nil
# for single VX character
if sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
@vx_or_xp = 0
# for XP single character
elsif sign.include?('#')
@cw = bitmap.width / 4
@ch = bitmap.height / 4
@vx_or_xp = 1
# for XP character set in VX format
else
@cw = bitmap.width / 16
@ch = bitmap.height / 8
@vx_or_xp = 1
end
# for VX character set
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
@vx_or_xp = 0
end
self.ox = @cw / 2
self.oy = @ch
end
end
end

#--------------------------------------------------------------------------
# ● update Transfer origin rect
#--------------------------------------------------------------------------
def update_src_rect
if @tile_id == 0
index = @character.character_index
# XP format
if @vx_or_xp == 1
pattern = @character.pattern < 4 ? @character.pattern : 1
sx = (index % 4 * 4 + pattern) * @cw
# VX format
else
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
end
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end