Sha256: 53ea97c2357b5a4d90226b551a4eef973c36472815f02a94ffca7e850c306d44

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

# Convenience module to set up an InputController
module Lotu
  module Controllable
    def is_controllable
      include InstanceMethods
    end

    module InstanceMethods
      def init_behavior
        super
        @_input_controller = nil
      end
      # This will call #go_up every game loop
      # Gosu::Button::KbUp => :go_up
      # This is the same as the above
      # Gosu::Button::KbUp => [:go_up, 0]
      #
      # This will call #go_up once
      # Gosu::Button::KbUp => [:go_up, false]
      #
      # This will call #go_up every 50ms
      # Gosu::Button::KbUp => [:go_up, 50]
      def set_keys(keys)
        @_input_controller = InputController.new(self, keys)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lotu-0.1.1 lib/lotu/behaviors/controllable.rb
lotu-0.1.0 lib/lotu/behaviors/controllable.rb