Draw collision lines for the platforms as well.
This highlits the issue with the broken collision and bouncing.
This commit is contained in:
parent
cc0f174be5
commit
efb0f93062
4 changed files with 22 additions and 4 deletions
|
@ -95,7 +95,7 @@ namespace cloonel {
|
||||||
void Character::Draw() const {
|
void Character::Draw() const {
|
||||||
m_texture->Render(GetPos(), WidthHeight(), m_screenRatio.Ratio(), true);
|
m_texture->Render(GetPos(), WidthHeight(), m_screenRatio.Ratio(), true);
|
||||||
#if defined(WITH_DEBUG_VISUALS)
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
m_bottomBarDrawable.Render(GetPos(), m_screenRatio.Ratio());
|
m_bottomBarDrawable.Render(m_bottomBar.From(), m_screenRatio.Ratio());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,15 +37,15 @@ namespace cloonel {
|
||||||
explicit DrawableLine ( SDLMain* parMain, Colour parColour );
|
explicit DrawableLine ( SDLMain* parMain, Colour parColour );
|
||||||
DrawableLine ( SDLMain* parMain, Colour parColour, const LineBase& parLine );
|
DrawableLine ( SDLMain* parMain, Colour parColour, const LineBase& parLine );
|
||||||
DrawableLine ( SDLMain* parMain, Colour parColour, const LineBase::Point& parStart, const LineBase::Point& parEnd );
|
DrawableLine ( SDLMain* parMain, Colour parColour, const LineBase::Point& parStart, const LineBase::Point& parEnd );
|
||||||
DrawableLine ( const DrawableLine& parOther ) = default;
|
DrawableLine ( const DrawableLine& ) = default;
|
||||||
virtual ~DrawableLine ( void ) noexcept = default;
|
virtual ~DrawableLine ( void ) noexcept = default;
|
||||||
|
|
||||||
DrawableLine& operator= ( const DrawableLine& ) = delete;
|
DrawableLine& operator= ( const DrawableLine& ) = default;
|
||||||
|
|
||||||
void Render ( const float2& parPos, const float2& parScaling ) const;
|
void Render ( const float2& parPos, const float2& parScaling ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDLMain* const m_sdlmain;
|
SDLMain* m_sdlmain;
|
||||||
Colour m_colour;
|
Colour m_colour;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ namespace cloonel {
|
||||||
m_size(parSize),
|
m_size(parSize),
|
||||||
m_collisionTop(new HorzCollisionBar(parPos, parSize.x())),
|
m_collisionTop(new HorzCollisionBar(parPos, parSize.x())),
|
||||||
m_surface(parTexture)
|
m_surface(parTexture)
|
||||||
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
|
, m_collisionTopDrawable(parSdlMain, Colour(215, 181, 3), static_cast<short2>(parPos), static_cast<short2>(parPos + float2(parSize.x(), 0.0f)))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
assert(m_surface);
|
assert(m_surface);
|
||||||
}
|
}
|
||||||
|
@ -44,6 +47,9 @@ namespace cloonel {
|
||||||
m_size(parOther.m_size),
|
m_size(parOther.m_size),
|
||||||
m_collisionTop(std::move(parOther.m_collisionTop)),
|
m_collisionTop(std::move(parOther.m_collisionTop)),
|
||||||
m_surface(parOther.m_surface)
|
m_surface(parOther.m_surface)
|
||||||
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
|
, m_collisionTopDrawable(parOther.m_collisionTopDrawable)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +62,9 @@ namespace cloonel {
|
||||||
///--------------------------------------------------------------------------
|
///--------------------------------------------------------------------------
|
||||||
void Platform::Draw() const {
|
void Platform::Draw() const {
|
||||||
m_surface->Render(TopLeft(), m_size, m_screenRatio.Ratio(), true);
|
m_surface->Render(TopLeft(), m_size, m_screenRatio.Ratio(), true);
|
||||||
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
|
m_collisionTopDrawable.Render(m_collisionTop->From(), m_screenRatio.Ratio());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
///--------------------------------------------------------------------------
|
///--------------------------------------------------------------------------
|
||||||
|
@ -66,6 +75,9 @@ namespace cloonel {
|
||||||
|
|
||||||
m_size = parOther.m_size;
|
m_size = parOther.m_size;
|
||||||
m_surface = parOther.m_surface;
|
m_surface = parOther.m_surface;
|
||||||
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
|
m_collisionTopDrawable = parOther.m_collisionTopDrawable;
|
||||||
|
#endif
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
#include "drawable.hpp"
|
#include "drawable.hpp"
|
||||||
#include "placeable.hpp"
|
#include "placeable.hpp"
|
||||||
#include "collidertypedef.hpp"
|
#include "collidertypedef.hpp"
|
||||||
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
|
# include "drawableline.hpp"
|
||||||
|
#endif
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -60,6 +63,9 @@ namespace cloonel {
|
||||||
ColliderUnregisterFunc m_unregisterFromCollider;
|
ColliderUnregisterFunc m_unregisterFromCollider;
|
||||||
std::unique_ptr<HorzCollisionBar> m_collisionTop;
|
std::unique_ptr<HorzCollisionBar> m_collisionTop;
|
||||||
Texture* m_surface;
|
Texture* m_surface;
|
||||||
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
|
DrawableLine m_collisionTopDrawable;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
} //namespace cloonel
|
} //namespace cloonel
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue