Polygon Dash
|
Check for collisions with other GameObject entities. More...
Public Member Functions | |
this (size_t owner, ComponentTransform transform, ComponentPlayerInputJump jump, bool *isActive) | |
Set up the script. | |
override void | Update () |
Update internal state of the script. | |
void | CheckForFloorCollision (GameObject other, const SDL_Rect *camera) |
Check whether a floor collision will happen on the next frame update. | |
void | HandleCollision (GameObject collidee, const SDL_Rect *camera) |
Check for collisions with other GameObject entities. | |
SDL_Rect | rotateRect (SDL_Rect rect, float angle, SDL_Rect box) |
Rotate a hitbox rectangle based on the rotation angle of the GameObject. | |
Public Member Functions inherited from ComponentScript | |
this (size_t id) | |
Store the owner id. | |
override void | Render (SDL_Renderer *renderer, SDL_Rect *camera) |
Render the given script. | |
Public Member Functions inherited from IComponent |
Public Attributes | |
ComponentTransform | mTransform |
The ComponentTransform of the linked GameObject. | |
ComponentPlayerInputJump | mJump |
The ComponentPlayerInputJump of the linked GameObject. | |
bool * | mIsActive |
A pointer to whether the linked GameObject is active. | |
Check for collisions with other GameObject entities.
|
inline |
Set up the script.
owner | the id of the linked GameObject. |
transform | the ComponentTransform of the linked GameObject. |
jump | the ComponentPlayerInputJump of the linked GameObject. |
isActive | a pointer to whether the linked GameObject is active. |
|
inline |
Check whether a floor collision will happen on the next frame update.
Check whether the current gravity, velocity, and position will result in a floor collision. If so, adjust the gravity/velocity value to land perfectly on top of the floor object.
|
inline |
Check for collisions with other GameObject entities.
If a collision is found, mark the player as inactive since they are now "dead."
Note: this intentionally does not differentiate between floor and enemy collisions. It is expected that CheckForFloorCollision has already been run.
|
inline |
Rotate a hitbox rectangle based on the rotation angle of the GameObject.
rect | the original position. |
angle | the angle to rotate by (either 90 , 180 , 270 , or 0 ). |
box | the rotation point. |
|
inlinevirtual |
Update internal state of the script.
Implements ComponentScript.