- [Instructor] Updating the engine.
Previously we looked at coding
the load level function.
In this video, we're going to load
sprite sheet texture and draw vertex array.
To get started, open the engine.cpp file,
and add a line of code that will load
the sprite sheet texture
at the end of the engine constructor.
After associate the sprite with the texture,
write a comment, load the texture
for the background vertex array.
Then, m_TextureTiles equal to TextureHolder,
GetTexture graphics/tiles_sheet.png.
In this line we're loading
the sprite sheet into m_TextureTiles.
Now, open the update.cpp file.
We'll make some changes and additions to this file.
After spawn Thomas and Bob comment,
we have m_Thomas.spawn.
We have to comment out this line
and the next line well,
and also m_TimeRemaining
and m_NewLevelRequired.
Now, first comment load a level,
then write loadLevel function.
Actually, you should delete
rather than comment out the lines
we are no longer using.
I've just shown it to you this way
so that the changes are clear.
All that should be in the if statement
is the call to loadLevel.
Finally, before we can see the results
of the work so far this section,
open the draw.cpp file.
We'll make some additions
to draw the vertex array that represents a level.
Now, inside the draw function
after m_Window.setView,
write a comment, draw the level,
and then m_Window.draw,
m_VALevel, and m_TextureTiles.
Here we draw the vertex array
that represents a level.
Now, we have to add the same line again
in the split screen view.
We do the same for RightView.
We have drawn the vertex array
for all screen options, right, left, full screen.
Now you can run the game.
Unfortunately, however, Thomas and Bob
fall straight through
all of our lovingly designed platforms.
You can press enter and see that.
For this reason, we can't try
and progress through the levels
and beat the clock.
We'll work on that in some time.
This video taught us how to update
the game engine.
Amazing.
In the next video, we'll see collision detection.