mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2026-02-04 09:19:19 +01:00
Fix Collision add basic digging
This commit is contained in:
@@ -107,13 +107,13 @@ namespace Collision
|
||||
dynamicRectangle.ContactMap[CollisionDirection::Bottom] = staticRectangle;
|
||||
}
|
||||
if (contactNormal.x < 0) {
|
||||
dynamicRectangle.ContactMap[CollisionDirection::Left] = staticRectangle;
|
||||
dynamicRectangle.ContactMap[CollisionDirection::Right] = staticRectangle;
|
||||
}
|
||||
if (contactNormal.y < 0) {
|
||||
dynamicRectangle.ContactMap[CollisionDirection::Top] = staticRectangle;
|
||||
}
|
||||
if (contactNormal.x > 0) {
|
||||
dynamicRectangle.ContactMap[CollisionDirection::Right] = staticRectangle;
|
||||
dynamicRectangle.ContactMap[CollisionDirection::Left] = staticRectangle;
|
||||
}
|
||||
|
||||
//dynamicRectangle.vel = dynamicRectangle.vel + contactNormal * Point2f(std::abs(dynamicRectangle.vel.x), std::abs(dynamicRectangle.vel.y)) * ( 1 - contact_time );
|
||||
@@ -126,9 +126,8 @@ namespace Collision
|
||||
bool ResolvePlayerVsRect(Player& player, float ElapsedTime, Collision::CollisionRect* staticRectangle) {
|
||||
CollisionRect rect = player.GetCollisionRect();
|
||||
Collision::ResolveDynamicRectVsRect(rect, ElapsedTime, staticRectangle);
|
||||
//dynamic_cast<TileCollisionRect*>(rect.ContactMap[CollisionDirection::Bottom])->tile->SetTileType(GroundTileTypes::Air);
|
||||
// std::map<CollisionDirection, TileCollisionRect*> test = rect.ContactMap;
|
||||
// player.SetContactMap(test);
|
||||
|
||||
|
||||
player.SetPosition(rect.pos);
|
||||
player.SetVelocity(rect.vel);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user