October 2016
Beginner
520 pages
10h 19m
English
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 ...
Read now
Unlock full access