Skip to content

Commit

Permalink
feat: added more sfx and fixing some misc bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
phuwit committed Oct 23, 2023
1 parent 58d2dfb commit 0ebdf46
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 17 deletions.
Binary file added assets/sfx/ammopickup.ogg
Binary file not shown.
Binary file added assets/sfx/error.ogg
Binary file not shown.
Binary file added assets/sfx/medkit.ogg
Binary file not shown.
Binary file added assets/sfx/reload.ogg
Binary file not shown.
21 changes: 12 additions & 9 deletions attribution.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# Attibution
- Used [SFML](https://www.sfml-dev.org) by Laurent Gomila under [zlib/png](https://www.sfml-dev.org/license.php) license.
- Used [CMake SFML Project Template](https://github.com/SFML/cmake-sfml-project) by [SFML Contributors](https://github.com/SFML/cmake-sfml-project/graphs/contributors) under [Public Domain or MIT](https://github.com/SFML/cmake-sfml-project/blob/master/LICENSE.md)
- Used free assets from [Craftpix](https://craftpix.net) under their [Freebie products file license](https://craftpix.net/file-licenses/)
- [SFML](https://www.sfml-dev.org) by Laurent Gomila under [zlib/png](https://www.sfml-dev.org/license.php) license.
- [CMake SFML Project Template](https://github.com/SFML/cmake-sfml-project) by [SFML Contributors](https://github.com/SFML/cmake-sfml-project/graphs/contributors) under [Public Domain or MIT](https://github.com/SFML/cmake-sfml-project/blob/master/LICENSE.md)
- free assets from [Craftpix](https://craftpix.net) under their [Freebie products file license](https://craftpix.net/file-licenses/)
- [Free 3 Cyberpunk Characters Pixel Art](https://craftpix.net/freebies/free-3-cyberpunk-characters-pixel-art/)
- [Free Extra Animations for Cyberpunk Characters](https://craftpix.net/freebies/free-extra-animations-for-cyberpunk-characters/)
- [Free Guns for Cyberpunk Characters Pixel Art](https://craftpix.net/freebies/free-guns-for-cyberpunk-characters-pixel-art/)
- [Free Guns Pack 2 for Main Characters Pixel Art](https://craftpix.net/freebies/free-guns-pack-2-for-main-characters-pixel-art/)
<!-- - Used [2D Dungeon Asset Pack](https://styloo.itch.io/2d-dungeon) by [Styloo](https://styloo.itch.io/) on itch.io, licensed under [CC0 1.0 (Public Domain Dedication)](https://creativecommons.org/publicdomain/zero/1.0/), or licensed under CC4.0 from readme but did not scpeified rights. contacted Styloo and waiting for a response. -->
- Used [2D Pixel Dungeon Asset Pack v2.0](https://pixel-poem.itch.io/dungeon-assetpuck) by [Pixel-Poem](https://pixel-poem.itch.io/) on itch.io, licensed under the clause `This asset pack can be used in free and commercial projects. You can modify it to suit your own needs. Credit is not necessary, but appreciated. You may not redistribute it or resell it.`
- Used [Space Shooter (Redux, plus fonts and sounds)](https://kenney.nl/assets/space-shooter-redux), Licensed Under [Creative Commons CC0](https://creativecommons.org/share-your-work/public-domain/cc0/) by [Kenney Vleugels](https://kenney.nl/)
- Used [Bebas Neue v2](http://bebasneue.com/), licensed under [SIL Open Font License, Version 1.1](https://github.com/dharmatype/Bebas-Neue/blob/master/OFL.txt)
<!-- - [2D Dungeon Asset Pack](https://styloo.itch.io/2d-dungeon) by [Styloo](https://styloo.itch.io/) on itch.io, licensed under [CC0 1.0 (Public Domain Dedication)](https://creativecommons.org/publicdomain/zero/1.0/), or licensed under CC4.0 from readme but did not scpeified rights. contacted Styloo and waiting for a response. -->
- [2D Pixel Dungeon Asset Pack v2.0](https://pixel-poem.itch.io/dungeon-assetpuck) by [Pixel-Poem](https://pixel-poem.itch.io/) on itch.io, licensed under the clause `This asset pack can be in free and commercial projects. You can modify it to suit your own needs. Credit is not necessary, but appreciated. You may not redistribute it or resell it.`
- [Space Shooter (Redux, plus fonts and sounds)](https://kenney.nl/assets/space-shooter-redux), Licensed Under [Creative Commons CC0](https://creativecommons.org/share-your-work/public-domain/cc0/) by [Kenney Vleugels](https://kenney.nl/)
- [Bebas Neue v2](http://bebasneue.com/), licensed under [SIL Open Font License, Version 1.1](https://github.com/dharmatype/Bebas-Neue/blob/master/OFL.txt)

# Audio
- Sound effects using [sfxr.me](sfxr.me)
- Used [ambient buttons » btn121.wav ](https://freesound.org/people/junggle/sounds/29301/), Licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), by [junggle](https://freesound.org/people/junggle/)
- Used [Clicks and switches » Click.wav](https://freesound.org/people/kwahmah_02/sounds/256116/), Licensed Under [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/), by [kwahmah_02](https://freesound.org/people/kwahmah_02/)
- [ambient buttons » btn121.wav](https://freesound.org/people/junggle/sounds/29301/), Licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), by [junggle](https://freesound.org/people/junggle/)
- [Clicks and switches » Click.wav](https://freesound.org/people/kwahmah_02/sounds/256116/), Licensed Under [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/), by [kwahmah_02](https://freesound.org/people/kwahmah_02/)
- [Snake's Authentic Gun Sounds](https://f8studios.itch.io/snakes-authentic-gun-sounds), Licensed under a clause `Most of the sounds in this pack can either be used as is or edited to fit your needs. All sounds can be used commercially, and credit is not needed (I would appreciate it a lot though!).` by [F8 Studios](https://f8studios.itch.io/)
- [AL's recordings » Error.wav](https://freesound.org/people/Autistic%20Lucario/sounds/142608/), Licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), by [Autistic Lucario](https://freesound.org/people/Autistic%20Lucario/)
- Half Life 2 Sound Effects, retrieved from [http://files.hldm.org/hl/sound/](http://files.hldm.org/hl/sound/)
- [Meganeko](https://soundcloud.com/meganeko) - [The Cyber Grind (Ultrakill Soundtrack)](https://soundcloud.com/meganeko/ultrakill)
- [coal bones](https://www.youtube.com/@CoalBones) - [Votely](https://www.youtube.com/watch?v=U9uUf4PnHyY)
- [Cheesy Hfj](https://www.youtube.com/@CheesyHfj) - [Spow](https://www.youtube.com/watch?v=3re7zdPidbU)
32 changes: 25 additions & 7 deletions source/Scenes/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,22 @@ Game::Game(Vector2f screenResolution, Vector2f levelSize) {
m_SoundHit.setBuffer(SoundHolder::GetSound("assets/sfx/hit.ogg"));
m_SoundKilled.setBuffer(SoundHolder::GetSound("assets/sfx/killed.ogg"));
m_SoundShoot.setBuffer(SoundHolder::GetSound("assets/sfx/shoot.ogg"));
m_SoundPickupLow.setBuffer(SoundHolder::GetSound("assets/sfx/pickup1.ogg"));
m_SoundPickupHigh.setBuffer(SoundHolder::GetSound("assets/sfx/pickup2.ogg"));
m_SoundReload.setBuffer(SoundHolder::GetSound("assets/sfx/reload.ogg"));
m_SoundError.setBuffer(SoundHolder::GetSound("assets/sfx/error.ogg"));
m_SoundPickupHealth.setBuffer(SoundHolder::GetSound("assets/sfx/medkit.ogg"));
m_SoundPickupAmmo.setBuffer(SoundHolder::GetSound("assets/sfx/ammopickup.ogg"));


m_SoundLoaded.setVolume(50);
m_SoundHit.setVolume(50);
m_SoundKilled.setVolume(50);
m_SoundShoot.setVolume(50);
m_SoundPickupLow.setVolume(50);
m_SoundPickupHigh.setVolume(50);
m_SoundReload.setVolume(20);
m_SoundError.setVolume(50);
m_SoundPickupHealth.setVolume(50);
m_SoundPickupAmmo.setVolume(50);

regenerate();
}
Expand All @@ -107,12 +114,15 @@ void Game::regenerate() {
}
m_CurrentBulletIndex = 0;
m_BulletsInClip = m_ClipSize;
m_SpareAmmo = 24;
m_SpareAmmo = 32;

m_NumZombies = 2 + (3 * currentLevel);
m_NumZombiesAlive = m_NumZombies;
delete[] m_Zombies;
m_Zombies = createHorde(m_NumZombies, (M_SPRITE_SCALING - 1), m_PlayArea);

removeBuff_(m_BuffType);
m_BuffTimer = seconds(0);
}

void Game::newGame() {
Expand Down Expand Up @@ -152,6 +162,8 @@ SceneChange Game::run(RenderWindow &window) {
musicPtr->setVolume(5);
musicPtr->play();

m_FrameTimeClock.restart();

while (!paused) {
// HANDLE INPUTS
Event event;
Expand Down Expand Up @@ -317,8 +329,14 @@ SceneChange Game::run(RenderWindow &window) {
if (bulletsDelta > m_SpareAmmo) {
bulletsDelta = m_SpareAmmo;
}
m_BulletsInClip += bulletsDelta;
m_SpareAmmo -= bulletsDelta;

if (bulletsDelta > 0) {
m_BulletsInClip += bulletsDelta;
m_SpareAmmo -= bulletsDelta;
m_SoundReload.play();
} else {
m_SoundError.play();
}

m_CurrentAmmoText.setString(to_string(m_BulletsInClip));
m_SpareAmmoText.setString(to_string(m_SpareAmmo));
Expand Down Expand Up @@ -432,11 +450,11 @@ void Game::handlePickUps_(PickupsType pickUpsType, int pickupValue, Time buffDur
m_PlayerHealth = m_PlayerMaxHealth;
}
m_HealthBar.setSize(Vector2f(m_HealthBarSegmentSize * m_PlayerHealth, m_HealthBar.getSize().y));
m_SoundPickupLow.play();
m_SoundPickupHealth.play();
} else if (pickUpsType == PickupsType::PICKUPS_AMMO) {
m_SpareAmmo += pickupValue;
m_SpareAmmoText.setString(to_string(m_SpareAmmo));
m_SoundPickupLow.play();
m_SoundPickupAmmo.play();
} else if (pickUpsType == PickupsType::PICKUPS_SPEED) {
m_Player.setSpeedWithMultiplier(pickupValue);
m_BuffTimer = buffDuration;
Expand Down
4 changes: 3 additions & 1 deletion source/Scenes/Game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ class Game : public Scenes {
Sound m_SoundKilled;
Sound m_SoundShoot;
Sound m_SoundReload;
Sound m_SoundPickupLow;
Sound m_SoundError;
Sound m_SoundPickupHigh;
Sound m_SoundPickupHealth;
Sound m_SoundPickupAmmo;

Player m_Player = Player(M_SPRITE_SCALING);
const Time M_LAST_HIT_COOLDOWN = milliseconds(300);
Expand Down

0 comments on commit 0ebdf46

Please sign in to comment.