class MessageLevel

Public Class Methods

new() click to toggle source
Calls superclass method Level::new
# File lib/rubyhop/level.rb, line 123
def initialize
  super
  @rubyguy = Rubyhop.image "rubyguy.png"

  create_image!
end

Public Instance Methods

create_image!() click to toggle source
# File lib/rubyhop/level.rb, line 134
def create_image!
  @msg = Rubyhop.text_image message
end
draw() click to toggle source
# 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() click to toggle source
# File lib/rubyhop/level.rb, line 130
def message
  "This is a dumb message, you should override it"
end
start!() click to toggle source
# File lib/rubyhop/level.rb, line 138
def start!
  create_image!
end
update() click to toggle source
# File lib/rubyhop/level.rb, line 142
def update
  quit!     if Rubyhop.button_down? Gosu::KbEscape
  continue! if ( Rubyhop.button_down?(Gosu::KbSpace)  ||
                 Rubyhop.button_down?(Gosu::KbReturn) ||
                 Rubyhop.button_down?(Gosu::KbEnter)  )
end