cooldown
This commit is contained in:
@@ -99,7 +99,7 @@ namespace Game::AGame {
|
||||
setTexture(mGroundTex);
|
||||
}
|
||||
|
||||
LOG("Š: " << w << " V: " << h);
|
||||
LOG("W: " << w << " H: " << h);
|
||||
//mSound.~Sound();
|
||||
}
|
||||
|
||||
@@ -109,13 +109,21 @@ namespace Game::AGame {
|
||||
//mTransform.scaleY = 1.f + 0.5f * std::cos(RUNNING_TIME() / 0.5f); // Pulsate scale for testing
|
||||
//Object::Camera::getInstance().move(1.f, 0.f);
|
||||
|
||||
if (mStateTransitionCooldownTimer > 0.f) {
|
||||
mStateTransitionCooldownTimer -= deltaTime;
|
||||
if (mStateTransitionCooldownTimer < 0.f) {
|
||||
mStateTransitionCooldownTimer = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
const float landBoundaryX = Game::GameManager::getSharedData<float>("terrainLandBoundaryX");
|
||||
const float halfWidth = mTex->getWidth() * mTransform.adjustedScaleX() / 2.f;
|
||||
|
||||
if (Input::isKeyPressed(SDL_SCANCODE_E)) {
|
||||
const bool nearShore = std::abs((mTransform.x + halfWidth) - landBoundaryX) <= mShoreMargin;
|
||||
if (nearShore) {
|
||||
if (nearShore && mStateTransitionCooldownTimer <= 0.f) {
|
||||
mIsShipMode = !mIsShipMode;
|
||||
mStateTransitionCooldownTimer = mStateTransitionCooldown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user