Sha256: 7fbc987fca7e03cd79e224112e98817cd445f1119022f956e9bb135f3216382c
Contents?: true
Size: 851 Bytes
Versions: 11
Compression:
Stored size: 851 Bytes
Contents
# # class RemoveShapes def initialize @shapes = [] end # # def add shape @shapes << shape end # # def remove_from environment, moveables # This iterator makes an assumption of one Shape per Star making it safe to remove # each Shape's Body as it comes up # If our Stars had multiple Shapes, as would be required if we were to meticulously # define their true boundaries, we couldn't do this as we would remove the Body # multiple times # We would probably solve this by creating a separate @remove_bodies array to remove the Bodies # of the Stars that were gathered by the Player # return if @shapes.empty? @shapes.each do |shape| environment.remove_body shape.body environment.remove_shape shape moveables.remove shape end @shapes.clear end end
Version data entries
11 entries across 11 versions & 1 rubygems