<commit_before>module PlanetDefense
  class Asteroid < Chingu::GameObject
	 attr_accessor :vel_x, :vel_y
	 
    def initialize(window)    
    
      #Getting window dimensions
      @screenWidth = $window.width  
      @screenHeight = $window.height  
    
      #Give asteroid random image
      @imageNum = rand(3) + 1  
      @image = Gosu::Image.new($window, "media/gfx/asteroid" + @imageNum.to_s + ".bmp", false)
		@frags = 3.times{ |i| Gosu::Image.new($window, "media/gfx/asteroid"  + @imageNum.to_s + "_" + (i+1).to_s + ".png") }

      #Asteroids start at top, with random x and angle
      @x = rand(@screenWidth * 1.5) - (@screenWidth * 0.25)  
      @y = -50  
      @angle = rand(360)  
      @vel_angular = rand(2) + 1  
      #vel_y can be positive (down only)
      @vel_x = @vel_y = rand(9) + 1  
      #vel_x can be positive or negative (left or right)
      if (rand(2) == 1)
        @vel_x *= -0.15  
      end
      #vel_angular can be positive or negative (left or right spin)
      if (rand(2) == 1)
        @vel_angular *= -1  
      end
    end
  
    def on_collision   
      #puts "#{self.class} #{self.x}/#{self.y}"

		@expl_options = { :x => @x, :y => @y }
		PlanetDefense::Explosion.create( @expl_options );
		
		self.reset
      # PlayState.asteroids.delete self
      # PlayState.asteroids.push( Asteroid.new($window) )
    end
  
    def move
      @x += @vel_x  
      @y += @vel_y  
      @angle += @vel_angular  
    
    end
  
    def draw
      @image.draw_rot(@x, @y, 1, @angle)
    end
  
    def x
      @x  
    end
  
    def y<commit_msg>Switched from drawing image to drawing each frag. Also added frags as an option for Explosion<commit_after>module PlanetDefense
  class Asteroid < Chingu::GameObject
	 attr_accessor :vel_x, :vel_y, :frags
	 
    def initialize(window)    
    
      #Getting window dimensions
      @screenWidth = $window.width  
      @screenHeight = $window.height  
    
      #Give asteroid random image
      @imageNum = rand(3) + 1  
      #@image = Gosu::Image.new($window, "media/gfx/asteroid" + @imageNum.to_s + ".bmp", false)
		@frags = Array.new(3) { |i| Gosu::Image.new($window, "media/gfx/asteroid"  + @imageNum.to_s + "_" + (i+1).to_s + ".png") }

      #Asteroids start at top, with random x and angle
      @x = rand(@screenWidth * 1.5) - (@screenWidth * 0.25)  
      @y = -50  
      @angle = rand(360)  
      @vel_angular = rand(2) + 1  
      #vel_y can be positive (down only)
      @vel_x = @vel_y = rand(9) + 1  
      #vel_x can be positive or negative (left or right)
      if (rand(2) == 1)
        @vel_x *= -0.15  
      end
      #vel_angular can be positive or negative (left or right spin)
      if (rand(2) == 1)
        @vel_angular *= -1  
      end
    end
  
    def on_collision   
      #puts "#{self.class} #{self.x}/#{self.y}"

		@expl_options = { :x => @x, :y => @y, :frags => @frags }
		PlanetDefense::Explosion.create( @expl_options );
		
		self.reset
      # PlayState.asteroids.delete self
      # PlayState.asteroids.push( Asteroid.new($window) )
    end
  
    def move
      @x += @vel_x  
      @y += @vel_y  
      @angle += @vel_angular  
    
    end
  
    def draw
      @frags.each{ |f| f.draw_rot(@x, @y, 1, @angle) }
    end
  
    def x
      @x  
    end
  
    def y
{'fraction_non_alphanumeric': 0.13596358118361154, 'fraction_numerical': 0.01638846737481032, 'mean_word_length': 2.074626865671642, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2950758', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1200, 'n_words': 301}