Module: Util

Defined in:
lib/util.rb

Instance Method Summary collapse

Instance Method Details

#background_image(pic) ⇒ Object



3
4
5
# File 'lib/util.rb', line 3

def background_image(pic)
  Gosu::Image.new(self, pic, true)
end

#key_pressed?(key) ⇒ Boolean

There are more keys than the ones below, this is just a start TODO: link here to a key map of all of the possiblities EXAMPLE: if key_pressed? :left … end

UP - :up Down - :down Left - :left Right - :right Space Bar :space #########################

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/util.rb', line 21

def key_pressed?(key)
  key_const = Gosu.const_get(:"Kb#{key.to_s.gsub(/\b\w/){$&.upcase}}")
  $game_window.button_down?(key_const)
end