Skip to content

Instantly share code, notes, and snippets.

@Ratstail91
Created July 6, 2014 18:00
Show Gist options
  • Save Ratstail91/b2822b67dd714591c7dc to your computer and use it in GitHub Desktop.
Save Ratstail91/b2822b67dd714591c7dc to your computer and use it in GitHub Desktop.
//check for collisions
for (int i = -6; i < 6; ++i) {
for (int j = -6; j < 6; ++j) {
Vector2 wallPoint = {
snapToBase(32.0, character.GetOrigin().x),
snapToBase(32.0, character.GetOrigin().y)
};
wallPoint.x += i * 32;
wallPoint.y += j * 32;
if (!pager.GetSolid(wallPoint.x / 32.0, wallPoint.y / 32.0)) {
continue;
}
if (checkOverlap(character.GetOrigin(), character.GetBounds(), wallPoint, {32.0, 32.0})) {
std::cout << "1";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment