Confira o Videos Épicos #45!
12 Respostas   1155 Visualizações
0 Membros e 1 Visitante estão vendo este tópico.
class Game_Interpreter alias old_wait wait def wait(duration) old_wait(duration) endendclass Game_Player < Game_Character alias old_jump jump def jump(x_plus, y_plus) #Jump... end alias novo_update update def update novo_update if Input.trigger?(:X) jump_by_input end end def jump_by_input #Chama o jump. Game_Interpreter.wait(120) endend
class Game_Interpreter...Linha 240: def wait(duration)Linha 241: duration.times { Fiber.yield } #Erro nesta linha. no Fiber.yield.Linha 242: end
class WaitingObject attr_reader :time, :active def initialize @time = 0 @active = false @_methods = [] end def add_method(method) @_methods << method end def clear_methods @_methods.clear end def wait(frames) @time = frames @active = true end def update @time -= 1 if @time > 0 if complete? && active @_methods.each(&:call) @active = false end end def abort @active = false end def complete? @time == 0 endend
class Scene_Wait < Scene_Base def start super @waiting = WaitingObject.new @waiting.add_method(method :gameover) @waiting.wait(600) # Espera 600 frames ou 10 segundos end def update super @waiting.update end def gameover SceneManager.goto(Scene_Gameover) endend