去年写的小东西
使用方法:
插入后面的脚本,在事件中设置移动路线->脚本->输入下面这行代码
如果需要不断循环就勾选循环执行
module CLD99_BUFFER BUFFER = 5 #控制刷新的快慢 end class Game_CharacterBase attr_accessor :loop end class Sprite_Character alias cld99_update_src_rect update_src_rect def update_src_rect return cld99_update_src_rect unless @character.loop @loop_state ||= 0 @buffer ||= 0 return (@buffer += 1) unless @buffer == CLD99_BUFFER::BUFFER x = @cw * (@loop_state % 3) y = @ch * (@loop_state / 3) self.src_rect.set(x, y, @cw, @ch) if @loop_state == 11 @loop_state = nil @buffer = nil @character.loop = false else @loop_state += 1 @buffer = 0 end end end
module CLD99_BUFFER
BUFFER = 5 #控制刷新的快慢
end
class Game_CharacterBase
attr_accessor :loop
end
class Sprite_Character
alias cld99_update_src_rect update_src_rect
def update_src_rect
return cld99_update_src_rect unless @character.loop
@loop_state ||= 0
@buffer ||= 0
return (@buffer += 1) unless @buffer == CLD99_BUFFER::BUFFER
x = @cw * (@loop_state % 3)
y = @ch * (@loop_state / 3)
self.src_rect.set(x, y, @cw, @ch)
if @loop_state == 11
@loop_state = nil
@buffer = nil
@character.loop = false
else
@loop_state += 1
@buffer = 0
end
end
end
|