October 2016
Beginner
520 pages
10h 19m
English
In order to be able to run the game and see our new characters, we have to declare instances of them, call their spawn functions, update them each frame, and draw them each frame. Let's do that now.
Open up the Engine.h file and add the highlighted lines of code, as shown in the following:
#pragma once #include <SFML/Graphics.hpp> #include "TextureHolder.h" #include "Thomas.h" #include "Bob.h" using namespace sf; class Engine { private: // The texture holder TextureHolder th; // Thomas and his friend, Bob Thomas m_Thomas; Bob m_Bob; const int TILE_SIZE = 50; const int VERTS_IN_QUAD = 4; ... ...
Now we have an instance of both Thomas and Bob, which ...
Read now
Unlock full access