Name 2 methods for detecting collisions in a game.
A game can detect collisions based on multiple methods.
2 very simple collision methods are:
- AABB Collisions (Axis Aligned Bounding Box) - direct collision within a frame, and
- Ray Casting - proximity collisions
Describe roughly how they work.
AABB collisions are simple rectangular collisions that are triggered when one subject rectangle overlaps another and responds accordingly at the frame in which they overlap.
A Ray Casting Collision will measure the distance between a particular sprite (e.g. your character) from another game object, and make changes accordingly.
The game designer can effect multiple outputs based on a ray collider, for example when the ray caster calculates you are 500px away from a finish line, the program could draw a "Nearly There! label onto the client.