Bouncing works but going too high causes an assertion.
This commit also reduces the jump size and the character's size.
This commit is contained in:
parent
df8f5ca6b2
commit
164030202c
9 changed files with 82 additions and 7 deletions
|
@ -28,28 +28,38 @@
|
|||
#include "collidertypedef.hpp"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
namespace cloonel {
|
||||
class SDLMain;
|
||||
class Texture;
|
||||
template <typename T, uint32_t S> class Line;
|
||||
|
||||
class Character : public Placeable, public Drawable {
|
||||
public:
|
||||
typedef std::function<void(const Line<float, 2>&, const float2&)> BounceCallbackType;
|
||||
|
||||
Character ( const std::string& parPath, SDLMain* parMain, float2 parSize );
|
||||
Character ( const std::string&& parPath, SDLMain* parMain, float2 parSize );
|
||||
Character ( const Character& ) = delete;
|
||||
virtual ~Character ( void ) noexcept;
|
||||
|
||||
void Prepare ( void );
|
||||
void Destroy ( void ) noexcept;
|
||||
virtual void Draw ( void ) const;
|
||||
void RegisterForCollision ( ColliderRegisterFunc parRegisterCollision );
|
||||
void SetOnBounceCallback ( BounceCallbackType parCallb );
|
||||
|
||||
private:
|
||||
//Overrides
|
||||
virtual void OnRegister ( Mover& parMover, Mover::PlaceableTicketType parParentTicket );
|
||||
|
||||
void OnBounce ( const Line<float, 2>& parCollision, const float2& parDirection );
|
||||
|
||||
HorzCollisionBar m_bottomBar;
|
||||
SizeNotifiable<regbehaviours::AutoRegister> m_screenRatio;
|
||||
BounceCallbackType m_bounceCallback;
|
||||
const std::unique_ptr<Texture> m_texture;
|
||||
};
|
||||
} //unnamed namespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue