| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 3 |  
| 经验 | 7803 |  
| 最后登录 | 2022-4-4 |  
| 在线时间 | 304 小时 |  
 Lv2.观梦者 
	梦石0 星屑330 在线时间304 小时注册时间2016-8-13帖子16 | 
| 
这个行走图脚本与XAS后,场所移动显示
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  #使用方法:在角色行走图片名中添加"[s5][m8]",则表示静止时每方向5张图片,移动时8张。
 #图片命名中如果有"[s5]"或者"[m8]"这样的字符串,则按给出的数字划分行走图,
 #否则按程序默认的方式划分         ---By 风宥雪
 #静止站立图也支持动态效果。
 class Sprite_Character < Sprite_Base
 #--------------------------------------------------------------------------
 # ● 设置角色的位图
 #--------------------------------------------------------------------------
 alias old_set_character_bitmap set_character_bitmap
 def set_character_bitmap
 @character.frame_total = 0         #记住要归零化
 @character.change = false
 if @character_name =~ /\[s(\d+)\]/i
 @character.frame_s = $1.to_i     #匹配静止帧数
 @character.change = true
 @character.frame_total += @character.frame_s
 else
 @character.frame_s = 0
 end
 if @character_name =~ /\[m(\d+)\]/i
 @character.frame_m = $1.to_i     #匹配移动帧数
 @character.change = true
 @character.frame_total += @character.frame_m
 else
 @character.frame_m  = 0
 end
 if @character.change
 if @character.frame_total == 0
 msgbox("你的人物行走图命名有问题,请仔细检查!用[s5][m8]表示静止5帧,行走8帧!")
 return
 else
 self.bitmap = Cache.character(@character_name)
 @cw = bitmap.width / @character.frame_total
 @ch = bitmap.height / 4
 self.ox = @cw / 2
 self.oy = @ch
 end
 else #沿用原来的情况
 old_set_character_bitmap
 @character.frame_s = 3
 end
 end
 #--------------------------------------------------------------------------
 # ● 更新源矩形
 #--------------------------------------------------------------------------
 alias old_update_src_rect update_src_rect
 def update_src_rect
 if @character.change
 if @tile_id == 0
 index = @character.character_index
 pattern = @character.pattern
 sx = pattern * @cw
 sy = (@character.direction - 2) / 2 * @ch
 self.src_rect.set(sx, sy, @cw, @ch)
 end
 else
 old_update_src_rect
 end
 end
 end
 
 class Game_CharacterBase
 attr_accessor   :move_speed               # 移动速度
 attr_accessor   :frame_m                  # 移动图片帧数(默认每个方向3张)
 attr_accessor   :frame_s                  # 静止图片动态帧数(0表示没动态)
 attr_accessor   :frame_total              # 更改总帧数
 attr_accessor   :change                   # 是否更改默认
 alias old_init initialize
 def initialize
 old_init
 @move_speed = 5.5
 @frame_m = 3
 @frame_s = 0
 @frame_total = 0
 @change = false
 @original_pattern = 0
 end
 
 alias old_set_graphic set_graphic
 def set_graphic(character_name, character_index)
 old_set_graphic(character_name, character_index)
 @original_pattern = 0
 end
 #--------------------------------------------------------------------------
 # ● 更改方向,不需要重置stop_count
 #--------------------------------------------------------------------------
 def set_direction(d)
 @direction = d if !@direction_fix && d != 0
 end
 end
 
 class Game_Character < Game_CharacterBase
 #--------------------------------------------------------------------------
 # ● 更新动画图案
 #--------------------------------------------------------------------------
 def update_anime_pattern
 #1.静止时,有无动态图
 if (!@step_anime && @stop_count > 0)
 if @frame_s == 0 #无动态图,则采用行走图
 @pattern = (@pattern + 1) % @frame_m
 else             #有动态图
 @pattern = (@pattern + 1) % @frame_s
 end
 #2.踏步动画或移动中时
 else
 if @frame_m == 0 #无行走图,则采用静止动态图
 @pattern = (@pattern + 1) % @frame_s
 else             #有行走图则采用行走图
 @pattern = @frame_s + (@pattern - @frame_s + 1) % @frame_m
 end
 end
 end
 #--------------------------------------------------------------------------
 # ● 更新动画计数
 #--------------------------------------------------------------------------
 def update_anime_count
 if moving? && @walk_anime
 @anime_count += 1.5
 elsif @step_anime || @pattern != @original_pattern || @frame_s > 1 || @walk_anime#静止有动态图时也要更新计数
 @anime_count += 0.75
 end
 end
 end
 
 #~ #==============================================================================
 #~ # ■ Game_Player
 #~ #------------------------------------------------------------------------------
 #~ #  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。
 #~ #   本类的实例请参考 $game_player 。
 #~ #==============================================================================
 #~ class Game_Player < Game_Character
 #~   #--------------------------------------------------------------------------
 #~   # ● 更新动画图案,添加了玩家移动时的脚步声。
 #~   #--------------------------------------------------------------------------
 #~   def update_anime_pattern
 #~     super
 #~       Audio.me_play("Audio/ME/脚步声") unless (!@step_anime && @stop_count > 0)
 #~   end
 #~ end
 求解,各位好心人
 
 | 
 |