1
00:00:00,810 --> 00:00:06,570
So we need to add in a few conditions into our gameplay, so notice now whenever we're moving around,

2
00:00:06,840 --> 00:00:10,040
we can actually move the character off of the visible area.

3
00:00:10,050 --> 00:00:12,110
So we want to have some restrictions for that.

4
00:00:12,390 --> 00:00:19,920
So adding in a condition to check to see the value of Player X and ensuring that Player X is greater

5
00:00:19,920 --> 00:00:20,410
than zero.

6
00:00:20,760 --> 00:00:26,550
So adding that condition in will stop the player from being able to move the character off screen.

7
00:00:26,820 --> 00:00:34,320
And you can apply that to all of the different movements so we can restrict where this one is has to

8
00:00:34,320 --> 00:00:42,570
be less than the value of we're going to do this dynamically because in case the player is adjusting

9
00:00:42,570 --> 00:00:48,390
their screen size, we're going to take the value of game area and make this bigger, because this is

10
00:00:48,390 --> 00:00:54,670
turning out to be a fairly long statement and we're going to use that off set with value.

11
00:00:54,690 --> 00:00:59,800
So this is what we saw earlier as well, where we're using these offset values for the left top.

12
00:00:59,850 --> 00:01:04,200
We can also get a width value and subtract 50 off of it.

13
00:01:04,530 --> 00:01:09,450
So that will give us the full right size again, going to increase the speed that the player can move.

14
00:01:09,450 --> 00:01:13,230
So I can show you the different boundaries that we have for the movement.

15
00:01:13,620 --> 00:01:16,470
There's also the up and down values.

16
00:01:16,770 --> 00:01:23,890
So making sure that Y is greater than zero and on the down.

17
00:01:24,330 --> 00:01:34,620
So as we're increasing, we want to make sure that the player X or player Y value is less than in here.

18
00:01:34,620 --> 00:01:41,280
We can use that same game offset width, but we can use the height value and if we want we could subtract

19
00:01:41,280 --> 00:01:42,260
off of it as well.

20
00:01:43,240 --> 00:01:47,410
So offset with some of offset with will use offset height.

21
00:01:48,220 --> 00:01:49,240
So now let's try that.

22
00:01:49,360 --> 00:01:53,600
So now it's created essentially a boundary area that we can't move off of.

23
00:01:54,190 --> 00:02:00,310
So I can see that once I get to the end of the boundaries, I can't move the character off of it.

24
00:02:00,520 --> 00:02:03,640
And that's why on the right side, I did the minus 50.

25
00:02:03,970 --> 00:02:06,690
So technically we should do that for here as well.

26
00:02:06,700 --> 00:02:12,910
We subtract out 50 and then that's going to restrict the ability for the character to move.

27
00:02:13,820 --> 00:02:18,950
Anywhere even close to the bottom, and sometimes you do have to play around and adjust some of the

28
00:02:18,950 --> 00:02:25,810
numbers as needed so you can go ahead and add the boundary and boundary restrictions to your character.

29
00:02:26,210 --> 00:02:32,030
And the one other thing that we want to add in as well is I wanted to have the ability to move the wings.

30
00:02:33,210 --> 00:02:35,490
And we'll take care of that in the next lesson.

31
00:02:35,730 --> 00:02:41,220
So for now, add in the different boundaries on the key movements within your game.
