Putting breakpoints in may significantly affect your idea of 'elapsedTime'.
Without breakpoints, elapsedTime might be 0, or so close to 0 that all your calculations show no movement.
You also seem to be duplicating data (which is bad).
1 2 3 4 5
|
float xPos, yPos, width, height;
Vector2 topLeft;
Vector2 topRight;
Vector2 bottomRight;
Vector2 bottomLeft;
| |
Create a computeHitbox function (what's bool hasHitbox; for?), and call it on demand, rather than trying to store it and keep it up to date whenever you move the object.
Use const references, not pointers or value copies.
> bool hasCollided(W_Object *other);
> void runIfHit(W_Object *other);
> bool vector2InObject(Vector2 vector);