Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool collided = false;
- for(Entity* e : Entity::instances)
- {
- if (e == this)
- {
- continue;
- }
- if (e->entClass == "ENTITY_MISSILE")
- {
- Missile* m = (Missile*)e;
- if (abs(position.x - m->position.x) * 2 < (boundingbox.w + m->boundingbox.w))
- {
- if (abs(position.y - m->position.y) * 2 < (boundingbox.h + m->boundingbox.h))
- {
- collided = true;
- break;
- }
- }
- }
- }
- if (collided)
- {
- TakeDamage();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement