Preparing sound effects

In this section, we will create all the SoundBuffer and Sound objects that we need to add a range of sound effects to the game.

Start by adding the required SFML includes:

#include "stdafx.h" 
#include <sstream> 
#include <fstream> 
#include <SFML/Graphics.hpp> 
#include <SFML/Audio.hpp> 
#include "ZombieArena.h" 
#include "Player.h" 
#include "TextureHolder.h" 
#include "Bullet.h" 
#include "Pickup.h" 

Now go ahead and add the seven SoundBuffer and Sound objects which load and prepare the seven sound files that we prepared in Chapter 6: Object-Oriented Programming, Classes, and SFML Views:

// When did we last update the HUD? int framesSinceLastHUDUpdate = 0; // What time was the last update Time timeSinceLastUpdate; // How often (in ...

Get Beginning C++ Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.