Created
April 14, 2016 16:27
-
-
Save krokrob/365e8630bbc9f7c07782f725245eff6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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