lib/cyberarm_engine/timer.rb in cyberarm_engine-0.13.0 vs lib/cyberarm_engine/timer.rb in cyberarm_engine-0.13.1

- old
+ new

@@ -1,23 +1,23 @@ -module CyberarmEngine - class Timer - def initialize(interval, looping = true, &block) - @interval = interval - @looping = looping - @block = block - - @last_interval = Gosu.milliseconds - @triggered = false - end - - def update - return if !@looping && @triggered - - if Gosu.milliseconds >= @last_interval + @interval - @last_interval = Gosu.milliseconds - @triggered = true - - @block.call if @block - end - end - end +module CyberarmEngine + class Timer + def initialize(interval, looping = true, &block) + @interval = interval + @looping = looping + @block = block + + @last_interval = Gosu.milliseconds + @triggered = false + end + + def update + return if !@looping && @triggered + + if Gosu.milliseconds >= @last_interval + @interval + @last_interval = Gosu.milliseconds + @triggered = true + + @block.call if @block + end + end + end end \ No newline at end of file