diff --git a/Mario.cpp b/Mario.cpp
index 13078ec..404ca5a 100644
--- a/Mario.cpp
+++ b/Mario.cpp
@@ -27,6 +27,11 @@ Mario::Mario()
Height = 64;
Velocity = 0.7;
sprite.setOrigin(Width / 2.f, Height / 2.f);
+
+
+
+ jumpBuffer.loadFromFile(JUMP_SOUND);
+ jumpSound.setBuffer(jumpBuffer);
}
@@ -42,8 +47,10 @@ void Mario::update(int mapWidth)
else
velocity.x = 0;
- if (Keyboard::isKeyPressed(Keyboard::Key::Up) && canJump)
+ if (Keyboard::isKeyPressed(Keyboard::Key::Up) && canJump) {
keyRel = true;
+ jumpSound.play();
+ }
if (keyRel && this->top() > 0 && canJump)
diff --git a/Mario.h b/Mario.h
index bb875a6..f83b066 100644
--- a/Mario.h
+++ b/Mario.h
@@ -9,6 +9,8 @@
#define WINDOW_WIDTH 1024
#define WINDOW_HEIGHT 512
+#define JUMP_SOUND "assets/JUMP.wav"
+
using namespace sf;
class Mario : public Entity
@@ -30,6 +32,9 @@ class Mario : public Entity
float flCurrentTime = 0;
float dt;
+ SoundBuffer jumpBuffer;
+ Sound jumpSound;
+
bool keyRel = false;
public:
diff --git a/Mario.vcxproj b/Mario.vcxproj
index f39c148..76f866c 100644
--- a/Mario.vcxproj
+++ b/Mario.vcxproj
@@ -145,6 +145,7 @@
+
@@ -159,6 +160,7 @@
+
diff --git a/Mario.vcxproj.filters.txt b/Mario.vcxproj.filters.txt
index 61c631e..fdb2db3 100644
--- a/Mario.vcxproj.filters.txt
+++ b/Mario.vcxproj.filters.txt
@@ -29,6 +29,9 @@
Header Files
+
+
+ Header Files
Header Files
@@ -65,6 +68,9 @@
Source Files
+
+ Source Files
+
Source Files