Libraries.Game.Collision.CollisionManager2D Documentation

This class can be seen as a "manager" class that uses CollisionEvent2D class and the BoardphaseCollision2D class to record if a collision occured, to decide if a collision occured. This class uses the CollisionEvent2D to record all of the collision that has occured during the current physics step. This class also uses the BroadphaseCollision2D class to determine whether a possible collision has happened.

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
AddCollisionListener(Libraries.Interface.Events.CollisionListener2D listener)This action adds a CollisionListener2D to the current CollisionManager2D.
AddPair(Libraries.Game.Collision.Item2DNode nodeA, Libraries.Game.Collision.Item2DNode nodeB)This action compares the two nodes in the DynamicBoundingVolumeTree2D to determine whether the items in the two nodes collide.
Collide()This action resolve every collision that is recorded in the CollisionEvent2D doubly linked list.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
Destroy(Libraries.Interface.Events.CollisionEvent2D collision)This action tests deletes a CollisionEvent2D in a doubly linked list of CollisionEvent2D.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
FindNewCollisions()This action uses the broadphase linked to this CollisionManager2D to test if two nodes are colliding.
GetBroadphase()This action returns the BroadphaseCollison2D that is used to solve a collision.
GetCollisionCount()This class returns how many CollisionEvent2D are available in this CollisionManager2D.
GetCollisionList()This action returns the first event in the doubly linked list of CollisionEvent2D.
GetCollisionListeners()This action returns all of the CollisionListen2D that is attached to the current CollisionManager2D through an array.
GetHashCode()This action gets the hash code for an object.
RemoveCollisionListener(Libraries.Interface.Events.CollisionListener2D listener)This action removes a CollisionListener2D from the current CollisionManager2D.
SetLayer(Libraries.Game.Layer2D layer)This action sets the 2D layer at which the objects lie on.

Actions Documentation

AddCollisionListener(Libraries.Interface.Events.CollisionListener2D listener)

This action adds a CollisionListener2D to the current CollisionManager2D.

Parameters

AddPair(Libraries.Game.Collision.Item2DNode nodeA, Libraries.Game.Collision.Item2DNode nodeB)

This action compares the two nodes in the DynamicBoundingVolumeTree2D to determine whether the items in the two nodes collide. If the items in the two nodes do collide, then the collision will be recorded inside this CollisionManager2D.

Parameters

Collide()

This action resolve every collision that is recorded in the CollisionEvent2D doubly linked list.

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

Destroy(Libraries.Interface.Events.CollisionEvent2D collision)

This action tests deletes a CollisionEvent2D in a doubly linked list of CollisionEvent2D.

Parameters

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

FindNewCollisions()

This action uses the broadphase linked to this CollisionManager2D to test if two nodes are colliding.

GetBroadphase()

This action returns the BroadphaseCollison2D that is used to solve a collision.

Example Code

use Libraries.Game.Collision.BroadphaseCollision2D
    use Libraries.Game.Collision.CollisionManager2D

        BroadphaseCollision2D broadphase
        CollisionManager2D collision

        broadphase = collision:GetBroadphase()

Return

Libraries.Game.Collision.BroadphaseCollision2D: The BroadphaseCollision2D that is used to solve a collision.

GetCollisionCount()

This class returns how many CollisionEvent2D are available in this CollisionManager2D.

Return

integer: how many CollisionEvent2D are available in this CollisionManager2D.

GetCollisionList()

This action returns the first event in the doubly linked list of CollisionEvent2D.

Return

Libraries.Interface.Events.CollisionEvent2D: the first event in the doubly linked list of CollisionEvent2D.

GetCollisionListeners()

This action returns all of the CollisionListen2D that is attached to the current CollisionManager2D through an array.

Return

Libraries.Containers.Array: all of the CollisionListen2D that is attached to the current CollisionManager2D through an array.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

RemoveCollisionListener(Libraries.Interface.Events.CollisionListener2D listener)

This action removes a CollisionListener2D from the current CollisionManager2D.

Parameters

SetLayer(Libraries.Game.Layer2D layer)

This action sets the 2D layer at which the objects lie on.

Parameters