Sha256: 8c7e0af6cde9124fc6bbb8bd7e4fd4bc70b3daa727f08f715c677c4f9a350562

Contents?: true

Size: 428 Bytes

Versions: 24

Compression:

Stored size: 428 Bytes

Contents

#
#
class Waves
  
  #
  #
  def initialize window
    @window = window
    @waves = {}
  end
  
  #
  #
  def add amount, type, time
    @waves[time] ||= []
    @waves[time] << [amount, type]
  end
  
  #
  #
  def check time
    if wave? time
      types = @waves[time]
      types.each { |amount, type| amount.times { @window.randomly_add type } }
    end
  end
  
  #
  #
  def wave? time
    !@waves[time].nil?
  end
  
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
gosu_extensions-0.1.23 lib/core/waves.rb
gosu_extensions-0.1.22 lib/core/waves.rb
gosu_extensions-0.1.21 lib/core/waves.rb
gosu_extensions-0.1.20 lib/core/waves.rb
gosu_extensions-0.1.19 lib/core/waves.rb
gosu_extensions-0.1.18 lib/core/waves.rb
gosu_extensions-0.1.17 lib/core/waves.rb
gosu_extensions-0.1.16 lib/core/waves.rb
gosu_extensions-0.1.15 lib/core/waves.rb
gosu_extensions-0.1.14 lib/waves.rb
gosu_extensions-0.1.13 lib/waves.rb
gosu_extensions-0.1.12 lib/waves.rb
gosu_extensions-0.1.11 lib/waves.rb
gosu_extensions-0.1.10 lib/waves.rb
gosu_extensions-0.1.9 lib/waves.rb
gosu_extensions-0.1.8 lib/waves.rb
gosu_extensions-0.1.7 lib/waves.rb
gosu_extensions-0.1.6 lib/waves.rb
gosu_extensions-0.1.5 lib/waves.rb
gosu_extensions-0.1.4 lib/waves.rb