class Star

Constants

POINT_VALUE_BASE

Public Class Methods

new(scale, screen_width, screen_height, x = nil, y = nil, options = {}) click to toggle source
Calls superclass method Pickup::new
# File line-em-up/models/star.rb, line 8
def initialize(scale, screen_width, screen_height, x = nil, y = nil, options = {})
  # @scale = scale
  # @image = get_image
  # @time_alive = 0
  @x = x || rand(screen_width)
  @y = y || 0
  super(scale, screen_width, screen_height, @x, @y, options)
  @color = Gosu::Color.new(0xff_000000)
  @color.red = rand(255 - 40) + 40
  @color.green = rand(255 - 40) + 40
  @color.blue = rand(255 - 40) + 40
end

Public Instance Methods

collected_by_player(player) click to toggle source

def update mouse_x = nil, mouse_y = nil, scroll_factor = 1

# Move towards bottom of screen
@y += 1
super(mouse_x, mouse_y)

end

# File line-em-up/models/star.rb, line 55
def collected_by_player player
  value = 0.02
  player.attack_speed += player.boost_increase * value
  if player.attack_speed > Player::MAX_ATTACK_SPEED
    player.attack_speed = Player::MAX_ATTACK_SPEED
    if player.health + value > player.class::MAX_HEALTH 
      player.health = player.class::MAX_HEALTH
    else

      player.health += 1
    end
  end
end
draw() click to toggle source

def get_radius

13 * @scale

end

# File line-em-up/models/star.rb, line 43
def draw
  # img = @image[Gosu.milliseconds / 100 % @image.size];
  # img.draw_rot(@x, @y, ZOrder::Pickups, @y, 0.5, 0.5, @scale, @scale, @color, :add)
  @image.draw_rot(@x, @y, ZOrder::Pickups, @y, 0.5, 0.5, @scale, @scale, @color, :add)
end
get_image() click to toggle source
# File line-em-up/models/star.rb, line 21
def get_image
  Gosu::Image.new("#{MEDIA_DIRECTORY}/single_star.png")
end
get_points() click to toggle source
# File line-em-up/models/star.rb, line 26
def get_points
  return POINT_VALUE_BASE
end