Method: Arcade::GameObject#initialize
- Defined in:
- lib/arcade/base.rb
#initialize(&block) ⇒ GameObject
Returns a new instance of GameObject.
172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/arcade/base.rb', line 172 def initialize &block @state = OpenStruct.new @keypress_listeners = {} @collision_listeners = {} @edge_callback = nil setup_defaults instance_exec &block # Every GameObject must have a name raise Arcade::Errors::NameError, "#{self.class}#name is nil" if self.name.nil? end |