diff --git a/src/samples/dolphin/dolphin.cpp b/src/samples/dolphin/dolphin.cpp index 841be31..36b766f 100755 --- a/src/samples/dolphin/dolphin.cpp +++ b/src/samples/dolphin/dolphin.cpp @@ -114,7 +114,7 @@ void Dolphin::onUpdate() oysters[i].update(); Vector3 vecDist = oysters[i].mesh.position - player.mesh.position; float dist = Math::sqrt(vecDist.x + vecDist.y + vecDist.z); - if (dist < 2.5F && player.getIsJumping() && oysters[i].isActive()) + if (dist < 2.5F && player.isJumping() && oysters[i].isActive()) { printf("Pickup %d Dist %d\n", i, dist); //oysters[i].setActive(false); diff --git a/src/samples/dolphin/objects/collectible.cpp b/src/samples/dolphin/objects/collectible.cpp index e1c76a1..9cd7d78 100644 --- a/src/samples/dolphin/objects/collectible.cpp +++ b/src/samples/dolphin/objects/collectible.cpp @@ -29,22 +29,12 @@ Collectible::~Collectible() { } -void Collectible::setActive(u8 b) -{ - bActive = b; -} - void Collectible::disappear() { bDisappearing = true; lift = 10; } -u8 Collectible::isActive() -{ - return bActive; -} - void Collectible::update() { mesh.rotation.y += 0.08F; @@ -58,4 +48,4 @@ void Collectible::update() bDisappearing = false; } } -} \ No newline at end of file +} diff --git a/src/samples/dolphin/objects/collectible.hpp b/src/samples/dolphin/objects/collectible.hpp index 775eb70..32795ea 100644 --- a/src/samples/dolphin/objects/collectible.hpp +++ b/src/samples/dolphin/objects/collectible.hpp @@ -24,8 +24,8 @@ public: ~Collectible(); void update(); void disappear(); - void setActive(u8 b); - u8 isActive(); + void setActive(const u8 &b) { bActive = b; } + u8 isActive() { return bActive; } private: u8 bActive, bDisappearing; diff --git a/src/samples/dolphin/objects/player.cpp b/src/samples/dolphin/objects/player.cpp index 125a3a5..aafe048 100755 --- a/src/samples/dolphin/objects/player.cpp +++ b/src/samples/dolphin/objects/player.cpp @@ -23,7 +23,7 @@ Player::Player() mesh.position.set(0.0F, 0.0F, 10.0f); mesh.rotation.x = -1.6F; mesh.setAnimSpeed(0.05F); - isJumping = false; + bIsJumping = false; } Player::~Player() @@ -62,9 +62,9 @@ void Player::update(Pad &t_pad) } if (mesh.getCurrentAnimationFrame() > 25 && mesh.getCurrentAnimationFrame() < 47) - isJumping = true; + bIsJumping = true; else - isJumping = false; + bIsJumping = false; /* if (lift < 0) mesh.rotation.y = 1; @@ -82,13 +82,8 @@ void Player::update(Pad &t_pad) } mesh.position.z += - Math::cos(mesh.rotation.z) * velocity * (isJumping + 1); + Math::cos(mesh.rotation.z) * velocity * (bIsJumping + 1); mesh.position.x += - Math::sin(mesh.rotation.z) * velocity * (isJumping + 1); + Math::sin(mesh.rotation.z) * velocity * (bIsJumping + 1); mesh.position.y += lift; } - -u8 Player::getIsJumping() -{ - return isJumping; -} \ No newline at end of file diff --git a/src/samples/dolphin/objects/player.hpp b/src/samples/dolphin/objects/player.hpp index fecbd51..c615d13 100755 --- a/src/samples/dolphin/objects/player.hpp +++ b/src/samples/dolphin/objects/player.hpp @@ -26,10 +26,10 @@ public: Player(); ~Player(); void update(Pad &t_pad); - u8 getIsJumping(); + const u8 &isJumping() { return bIsJumping; } private: - u8 isJumping; + u8 bIsJumping; Vector3 playerNextPosition; };