Sha256: 177746a3c13cafe83268c6bbb5bb4eb78ad222766222f7f576a66be768829409
Contents?: true
Size: 502 Bytes
Versions: 10
Compression:
Stored size: 502 Bytes
Contents
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
Version data entries
10 entries across 10 versions & 1 rubygems