CollisionManager

Description

Will be a static class that has methods to test different types of collisions that return a bool to indicate if there was a collision or not. This class will not be modifying any properties of anything, just returning if there was a collision or not. Properties that need to be changed based on collisions will be handled in the LevelManager.

Relationships

  • LevelManager : the level manager will be using the methods in here to test collisions and update the game objects accordingly.
  • CollisionObject : can use the CollisionObject struct to test collisions

Members

  • none

Methods

  • TestCollision(BB, BB)
    • will test for a collision between 2 bounding boxes, represented by 2 rectangles. If there is a collision it will return true.
  • TestCollision(BB, ray)
    • will test for a collision between a bounding box, a rectangle, and a ray, 2 Vector2 points. If there is a collision it will return true.
  • TestCollision(ray, ray)
    • will test for a collision between 2 rays, each represented by 2 Vector2 points. If there is a collision it will return true.
  • Walkable
    • This method will take in two texture2Ds, one being a color map, and the other being a sprite of a player/enemy
    • it will access the color data of both textures and compare the two
    • if any part of the player/enemy texture corresponds to a non-walkable area on the color map(white) then it will return false, otherwise true
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License