本帖最后由 Sion 于 2013-1-29 20:08 编辑
插入脚本,把你的行走图扩展成12*4的规格,上下左右参照游戏里的其他行走图。然后把你的12格行走图重命名,前面加个#,导入character文件夹。设置行走图的时候注意要选第一个区域。class Sprite_Character < Sprite_Base #-------------------------------------------------------------------------- # ● 设置角色的位图 #-------------------------------------------------------------------------- def set_character_bitmap self.bitmap = Cache.character(@character_name) sign = @character_name[/^[\!\$\#]./] if sign && sign.include?('#') @cw = bitmap.width / 12 @ch = bitmap.height / 4 elsif sign && sign.include?('$') @cw = bitmap.width / 3 @ch = bitmap.height / 4 else @cw = bitmap.width / 12 @ch = bitmap.height / 8 end self.ox = @cw / 2 self.oy = @ch end #-------------------------------------------------------------------------- # ● 更新源矩形 #-------------------------------------------------------------------------- def update_src_rect if @tile_id == 0 index = @character.character_index if @character.character_name[0, 1] == '#' pattern = @character.pattern sx = (index % 12 + pattern) * @cw sy = (index + (@character.direction - 2) / 2) * @ch else pattern = @character.pattern < 3 ? @character.pattern : 1 sx = (index % 4 * 3 + pattern) * @cw sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch end self.src_rect.set(sx, sy, @cw, @ch) end end end class Game_CharacterBase #-------------------------------------------------------------------------- # ● 更新动画图案 #-------------------------------------------------------------------------- def update_anime_pattern if !@step_anime && @stop_count > 0 @pattern = @original_pattern else if @character_name[0, 1] == '#' @pattern = (@pattern + 1) % 12 else @pattern = (@pattern + 1) % 4 end end end end
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● 设置角色的位图
#--------------------------------------------------------------------------
def set_character_bitmap
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$\#]./]
if sign && sign.include?('#')
@cw = bitmap.width / 12
@ch = bitmap.height / 4
elsif sign && sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
end
#--------------------------------------------------------------------------
# ● 更新源矩形
#--------------------------------------------------------------------------
def update_src_rect
if @tile_id == 0
index = @character.character_index
if @character.character_name[0, 1] == '#'
pattern = @character.pattern
sx = (index % 12 + pattern) * @cw
sy = (index + (@character.direction - 2) / 2) * @ch
else
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
end
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end
class Game_CharacterBase
#--------------------------------------------------------------------------
# ● 更新动画图案
#--------------------------------------------------------------------------
def update_anime_pattern
if !@step_anime && @stop_count > 0
@pattern = @original_pattern
else
if @character_name[0, 1] == '#'
@pattern = (@pattern + 1) % 12
else
@pattern = (@pattern + 1) % 4
end
end
end
end
差不多就是这样。
|