Add an offset in HorzCollisionBar and reset it at the beginning of every frame.

This commit is contained in:
King_DuckZ 2014-08-01 16:41:55 +02:00
parent cdd37fead7
commit 3522ce37a3
8 changed files with 67 additions and 10 deletions

View file

@ -20,6 +20,8 @@
#include "gameplayscene.hpp"
#include "mover.hpp"
#include "drawable.hpp"
#include "placeable.hpp"
#include <unordered_set>
namespace cloonel {
///--------------------------------------------------------------------------
@ -32,8 +34,18 @@ namespace cloonel {
///--------------------------------------------------------------------------
///--------------------------------------------------------------------------
void GameplayScene::OnUpdate (float parDelta) {
for (auto itMover : m_movers) {
itMover->Update(parDelta);
{
std::unordered_set<Placeable*> notify;
for (auto mover : m_movers) {
mover->CopyPlaceables(notify);
}
for (auto placeable : notify) {
assert(placeable);
placeable->BeginMovement();
}
}
for (auto mover : m_movers) {
mover->Update(parDelta);
}
m_collider.RunCollisionTests(parDelta);
}