Class: MessageLevel
Direct Known Subclasses
Instance Method Summary collapse
- #create_image! ⇒ Object
- #draw ⇒ Object
-
#initialize ⇒ MessageLevel
constructor
A new instance of MessageLevel.
- #message ⇒ Object
- #start! ⇒ Object
- #update ⇒ Object
Methods inherited from Level
#continue!, #fail!, #on_continue, #on_fail, #on_quit, #quit!
Constructor Details
#initialize ⇒ MessageLevel
Returns a new instance of MessageLevel.
123 124 125 126 127 128 |
# File 'lib/rubyhop/level.rb', line 123 def initialize super @rubyguy = Rubyhop.image "rubyguy.png" create_image! end |
Instance Method Details
#create_image! ⇒ Object
134 135 136 |
# File 'lib/rubyhop/level.rb', line 134 def create_image! @msg = Rubyhop.text_image end |
#draw ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/rubyhop/level.rb', line 149 def draw c = Math.cos(Rubyhop.time*4) half_w = Rubyhop.width / 2 half_h = Rubyhop.height / 2 scale = 1.0+c*0.1 @rubyguy.draw_rot(half_w, half_h - 80, 1, 0, 0.5, 0.5, scale, scale) s = Math.sin Rubyhop.time scale = 1.0+(0.1*s**3).abs @msg.draw_rot( (half_w + (100*(s)).to_i), (half_h + 160 + (50*s**3).abs), 1, s*5, 0.5, 0.5, scale, scale, Gosu::Color::RED ) end |
#message ⇒ Object
130 131 132 |
# File 'lib/rubyhop/level.rb', line 130 def "This is a dumb message, you should override it" end |
#start! ⇒ Object
138 139 140 |
# File 'lib/rubyhop/level.rb', line 138 def start! create_image! end |