Class: Bomp::CollisionInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/bomp.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item, other, goal, overlaps, response) ⇒ CollisionInfo

Returns a new instance of CollisionInfo.



211
212
213
214
215
216
217
218
219
220
221
# File 'lib/bomp.rb', line 211

def initialize(item, other, goal, overlaps, response)
  @item = item
  @other = other
  @goal = goal
  @overlaps = overlaps
  @response = response
  @normal = Vector2[
    goal[0] <=> 0,
    goal[1] <=> 0
  ]
end

Instance Attribute Details

#goalObject (readonly)

Returns the value of attribute goal.



209
210
211
# File 'lib/bomp.rb', line 209

def goal
  @goal
end

#itemObject (readonly)

Returns the value of attribute item.



209
210
211
# File 'lib/bomp.rb', line 209

def item
  @item
end

#otherObject (readonly)

Returns the value of attribute other.



209
210
211
# File 'lib/bomp.rb', line 209

def other
  @other
end

#overlapsObject (readonly)

Returns the value of attribute overlaps.



209
210
211
# File 'lib/bomp.rb', line 209

def overlaps
  @overlaps
end

#responseObject (readonly)

Returns the value of attribute response.



209
210
211
# File 'lib/bomp.rb', line 209

def response
  @response
end

Class Method Details

.[](*args) ⇒ Object



227
228
229
# File 'lib/bomp.rb', line 227

def self.[](*args)
  CollisionInfo.new *args
end

Instance Method Details

#to_sObject



223
224
225
# File 'lib/bomp.rb', line 223

def to_s
  [@item, @other, @goal, @overlaps, @response, @normal].to_s
end