Sha256: 5752a09d9e60aa17622cea5ba7d49c06afa1c2f32286c9c6903e6bd89611228a
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
# Also taken from the tutorial, but drawn with draw_rot and an increasing angle # for extra rotation coolness! require_relative 'pickup.rb' class Star < Pickup POINT_VALUE_BASE = 2 def initialize(scale, x = nil, y = nil) @scale = scale @image = get_image @time_alive = 0 @color = Gosu::Color.new(0xff_000000) @color.red = rand(255 - 40) + 40 @color.green = rand(255 - 40) + 40 @color.blue = rand(255 - 40) + 40 @x = x || rand * 800 @y = y || 0 @image_width = 25 * @scale @image_height = 25 * @scale @image_radius = 13 * @scale @current_speed = SCROLLING_SPEED * @scale end def get_image Gosu::Image.new("#{MEDIA_DIRECTORY}/single_star.png") end def get_points return POINT_VALUE_BASE end # def get_height # 25 * @scale # end # def get_width # 25 * @scale # end # def get_radius # 13 * @scale # end 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 # def update mouse_x = nil, mouse_y = nil # # Move towards bottom of screen # @y += 1 # super(mouse_x, mouse_y) # end def collected_by_player player player.attack_speed += 0.1 player.attack_speed = Player::MAX_ATTACK_SPEED if player.attack_speed > Player::MAX_ATTACK_SPEED end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
line-em-up-0.3.5 | line-em-up/models/star.rb |