Sha256: 017f4834a4220928e14cf636a10497a211179e45a8696a7a8e199439de4b2a36

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require_relative 'projectile.rb'
class EnemyHomingMissile < Projectile
  attr_reader :x, :y, :time_alive, :mouse_start_x, :mouse_start_y, :health
  COOLDOWN_DELAY = 75
  MAX_SPEED      = 18
  STARTING_SPEED = 0.0
  INITIAL_DELAY  = 2
  SPEED_INCREASE_FACTOR = 0.5
  DAMAGE = 15
  AOE = 0
  
  MAX_CURSOR_FOLLOW = 4
  # ADVANCED_HIT_BOX_DETECTION = true
  ADVANCED_HIT_BOX_DETECTION = false

  def get_image
    # Gosu::Image.new("#{MEDIA_DIRECTORY}/mini_missile_reverse.png")
    Gosu::Image.new("#{MEDIA_DIRECTORY}/mini_missile.png")
  end

  def initialize(scale, screen_width, screen_height, object, homing_object, angle_min, angle_max, angle_init, options = {})
    options[:relative_object] = object
    super(scale, screen_width, screen_height, object, homing_object.x, homing_object.y, angle_min, angle_max, angle_init, options)
    @health = 5
  end

  def destructable?
    true
  end

  def is_alive
    @health > 0
  end


  def take_damage damage
    @health -= damage
  end


  def update mouse_x = nil, mouse_y = nil
    if is_alive
      super(mouse_x, mouse_y)
    else
      false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
line-em-up-0.3.6 line-em-up/models/enemy_homing_missile.rb