From de7ee5ef022a8ccaece0ea5f5402adedeafe36b4 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 12 Mar 2022 09:05:21 -0500 Subject: added back bump sound (and assets for fuller music) --- src/main.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 25da94f..cd1a8c2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,7 +106,11 @@ bool movePlayer(Game& game, int x, int y) return true; } else { - //game.muxer.playSoundAtPosition("bump", game.player_x, game.player_y); + if (!game.alreadyBumped) { + game.muxer.playSoundAtPosition("bump", x, y); + game.alreadyBumped = true; + game.bumpCooldown.reset(); + } return false; } @@ -409,7 +413,7 @@ void setZoom(Game& game, size_t zoom) { game.curBoundY = game.map.getBottom() - zoom * ZOOM_Y_FACTOR; } - + int zoomLevel = getZoomLevel(game); if (zoomLevel == 0) { game.muxer.setMusicLevel(0); @@ -538,6 +542,7 @@ int main(int, char**) game.numLamps++; game.dirtyLighting = true; kickUpDust(game, game.player_x, game.player_y, 0); + game.muxer.playSoundAtPosition("drop", game.player_x, game.player_y); if (game.firstInput) { @@ -576,6 +581,8 @@ int main(int, char**) std::get<0>(moveTo), std::get<1>(moveTo)); } + + //game.muxer.playSoundAtPosition("dash", game.player_x, game.player_y); } } } @@ -592,6 +599,11 @@ int main(int, char**) keystate.up = state[SDL_SCANCODE_UP]; keystate.down = state[SDL_SCANCODE_DOWN]; + game.bumpCooldown.accumulate(frameTime); + if (game.alreadyBumped && keystate != game.lastInput && game.bumpCooldown.step()) { + game.alreadyBumped = false; + } + if (keystate.left || keystate.right || keystate.up || keystate.down) { game.firstInput = true; -- cgit 1.4.1