mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 20:41:47 +01:00
Add Building, Add Hard floors
This commit is contained in:
@@ -19,6 +19,7 @@ Player::Player(const Vector2f& Position, TextureManager* manager) : m_Position(P
|
||||
m_walkAnimation = new Animation(
|
||||
manager->GetTexture("animations/player/player_walk.png"),
|
||||
8, 0.1f, Rectf { 0, 0, 70, 70 });
|
||||
m_currentAnimation = m_walkAnimation;
|
||||
}
|
||||
Collision::CollisionRect Player::GetCollisionRect() const {
|
||||
Collision::CollisionRect rect = { m_Position, m_Size, m_Vel };
|
||||
@@ -34,10 +35,10 @@ void Player::Draw() const {
|
||||
|
||||
const int frameWidth = 70; //TODO: fix this
|
||||
int halfFrameWidth = frameWidth / 2;
|
||||
float bobOffset = m_BobUp ? 1 : 0;
|
||||
Vector2f drawPos = Vector2f { center.x - halfFrameWidth, center.y - halfFrameWidth + 9 + bobOffset} ;
|
||||
|
||||
Vector2f drawPos = Vector2f { center.x - halfFrameWidth, center.y - halfFrameWidth + 9 };
|
||||
|
||||
m_walkAnimation->Draw(drawPos, Rectf { drawPos.x, drawPos.y, frameWidth, frameWidth });
|
||||
m_walkAnimation->Draw(drawPos, Rectf { drawPos.x, drawPos.y , frameWidth, frameWidth });
|
||||
}
|
||||
void Player::ProcessImGui() {
|
||||
ImGui::Begin("Collision Info", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
@@ -56,6 +57,8 @@ void Player::ProcessImGui() {
|
||||
break;
|
||||
}
|
||||
ImGui::Text("Player State %s", currentState.c_str());
|
||||
ImGui::Text("Bob counter: %f", m_BobTimer);
|
||||
ImGui::Text("Bob up: %s", m_BobUp ? "true" : "false");
|
||||
|
||||
|
||||
//ContactMap
|
||||
@@ -68,7 +71,11 @@ void Player::ProcessImGui() {
|
||||
}
|
||||
|
||||
void Player::Update(float elapsedTime, WorldLevel& level) {
|
||||
|
||||
m_BobTimer += elapsedTime;
|
||||
if(m_BobTimer >= m_BobTime) {
|
||||
m_BobUp = !m_BobUp;
|
||||
m_BobTimer = 0.0f;
|
||||
}
|
||||
|
||||
//check for keys
|
||||
if(m_State != PlayerState::Digging) {
|
||||
|
||||
Reference in New Issue
Block a user