Skip to content

Instantly share code, notes, and snippets.

@krokrob
Created April 14, 2016 16:27
Show Gist options
  • Select an option

  • Save krokrob/365e8630bbc9f7c07782f725245eff6f to your computer and use it in GitHub Desktop.

Select an option

Save krokrob/365e8630bbc9f7c07782f725245eff6f to your computer and use it in GitHub Desktop.
class Star
attr_reader :x, :y
def initialize(animation)
@animation = animation
@color = Gosu::Color.new(0xff_000000)
@color.red = rand(256 - 40) + 40
@color.green = rand(256 - 40) + 40
@color.blue = rand(256 - 40) + 40
@x = rand * 640
@y = rand * 480
end
def draw
img = @animation[Gosu::milliseconds / 100 % @animation.size];
img.draw(@x - img.width / 2.0, @y - img.height / 2.0, 1 , 1, 1, @color, :add)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment