1
00:00:01,005 --> 00:00:03,003
- [Instructor] Updating the engine.

2
00:00:03,003 --> 00:00:04,007
Previously we looked at coding

3
00:00:04,007 --> 00:00:06,006
the load level function.

4
00:00:06,006 --> 00:00:08,002
In this video, we're going to load

5
00:00:08,002 --> 00:00:12,003
sprite sheet texture
and draw vertex array.

6
00:00:12,003 --> 00:00:15,008
To get started, open the engine.cpp file,

7
00:00:15,008 --> 00:00:17,006
and add a line of code that will load

8
00:00:17,006 --> 00:00:19,003
the sprite sheet texture

9
00:00:19,003 --> 00:00:22,001
at the end of the engine constructor.

10
00:00:22,001 --> 00:00:24,008
After associate the
sprite with the texture,

11
00:00:24,008 --> 00:00:27,002
write a comment, load the texture

12
00:00:27,002 --> 00:00:30,008
for the background vertex array.

13
00:00:30,008 --> 00:00:36,002
Then, m_TextureTiles
equal to TextureHolder,

14
00:00:36,002 --> 00:00:42,003
GetTexture graphics/tiles_sheet.png.

15
00:00:42,003 --> 00:00:43,008
In this line we're loading

16
00:00:43,008 --> 00:00:48,001
the sprite sheet into m_TextureTiles.

17
00:00:48,001 --> 00:00:51,006
Now, open the update.cpp file.

18
00:00:51,006 --> 00:00:54,001
We'll make some changes
and additions to this file.

19
00:00:54,001 --> 00:00:56,005
After spawn Thomas and Bob comment,

20
00:00:56,005 --> 00:00:59,004
we have m_Thomas.spawn.

21
00:00:59,004 --> 00:01:01,003
We have to comment out this line

22
00:01:01,003 --> 00:01:03,004
and the next line well,

23
00:01:03,004 --> 00:01:06,000
and also m_TimeRemaining

24
00:01:06,000 --> 00:01:09,001
and m_NewLevelRequired.

25
00:01:09,001 --> 00:01:11,009
Now, first comment load a level,

26
00:01:11,009 --> 00:01:14,006
then write loadLevel function.

27
00:01:14,006 --> 00:01:16,001
Actually, you should delete

28
00:01:16,001 --> 00:01:17,009
rather than comment out the lines

29
00:01:17,009 --> 00:01:19,007
we are no longer using.

30
00:01:19,007 --> 00:01:21,005
I've just shown it to you this way

31
00:01:21,005 --> 00:01:23,006
so that the changes are clear.

32
00:01:23,006 --> 00:01:25,004
All that should be in the if statement

33
00:01:25,004 --> 00:01:28,000
is the call to loadLevel.

34
00:01:28,000 --> 00:01:29,008
Finally, before we can see the results

35
00:01:29,008 --> 00:01:31,008
of the work so far this section,

36
00:01:31,008 --> 00:01:34,007
open the draw.cpp file.

37
00:01:34,007 --> 00:01:35,007
We'll make some additions

38
00:01:35,007 --> 00:01:39,000
to draw the vertex array
that represents a level.

39
00:01:39,000 --> 00:01:41,000
Now, inside the draw function

40
00:01:41,000 --> 00:01:44,000
after m_Window.setView,

41
00:01:44,000 --> 00:01:46,002
write a comment, draw the level,

42
00:01:46,002 --> 00:01:49,008
and then m_Window.draw,

43
00:01:49,008 --> 00:01:54,003
m_VALevel, and m_TextureTiles.

44
00:01:54,003 --> 00:01:56,000
Here we draw the vertex array

45
00:01:56,000 --> 00:01:58,003
that represents a level.

46
00:01:58,003 --> 00:02:00,008
Now, we have to add the same line again

47
00:02:00,008 --> 00:02:10,001
in the split screen view.

48
00:02:10,001 --> 00:02:17,006
We do the same for RightView.

49
00:02:17,006 --> 00:02:19,000
We have drawn the vertex array

50
00:02:19,000 --> 00:02:24,007
for all screen options,
right, left, full screen.

51
00:02:24,007 --> 00:02:26,003
Now you can run the game.

52
00:02:26,003 --> 00:02:28,009
Unfortunately, however, Thomas and Bob

53
00:02:28,009 --> 00:02:29,007
fall straight through

54
00:02:29,007 --> 00:02:32,005
all of our lovingly designed platforms.

55
00:02:32,005 --> 00:02:34,007
You can press enter and see that.

56
00:02:34,007 --> 00:02:36,004
For this reason, we can't try

57
00:02:36,004 --> 00:02:37,007
and progress through the levels

58
00:02:37,007 --> 00:02:39,001
and beat the clock.

59
00:02:39,001 --> 00:02:41,005
We'll work on that in some time.

60
00:02:41,005 --> 00:02:43,004
This video taught us how to update

61
00:02:43,004 --> 00:02:44,005
the game engine.

62
00:02:44,005 --> 00:02:45,008
Amazing.

63
00:02:45,008 --> 00:02:49,005
In the next video, we'll
see collision detection.

