主角(分_右).jpg (175.79 KB, 下载次数: 28)
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
test.gif (799.88 KB, 下载次数: 29)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |