diff options
Diffstat (limited to 'components/03_player_control.rb')
| -rw-r--r-- | components/03_player_control.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/components/03_player_control.rb b/components/03_player_control.rb new file mode 100644 index 0000000..d5d8f7a --- /dev/null +++ b/components/03_player_control.rb @@ -0,0 +1,21 @@ +class Components + # Gives control(keyboard or otherwise) over an object + class PlayerControl < Helper::BaseComponent + attr_accessor :north, :south, :east, :west, :interact, :menu + + def initialize + @north = 'up' + @south = 'down' + @east = 'right' + @west = 'left' + @interact = 'space' + @menu = 'enter' + end + + def set(**opts) + opts.each do |key, value| + send "#{key}=", value + end + end + end +end |
