Module: Util
- Defined in:
- lib/util.rb
Instance Method Summary collapse
- #background_image(pic) ⇒ Object
-
#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 …
- #set_game_window(game) ⇒ Object
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 #########################
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.(key_const) end |
#set_game_window(game) ⇒ Object
26 27 28 29 30 |
# File 'lib/util.rb', line 26 def set_game_window(game) # For now, use $game_window # This may change $game_window = game end |