1
00:00:00,610 --> 00:00:07,030
Are you ready to move the wings of the bird and we saw that we can move the character around depending

2
00:00:07,030 --> 00:00:07,940
on the key process.

3
00:00:08,710 --> 00:00:11,710
Now let's add in the ability to move the wings.

4
00:00:11,890 --> 00:00:17,310
So we want the wing movement to take place every time one of these keys is being pressed.

5
00:00:17,320 --> 00:00:20,110
But we don't want to take place if it's not being pressed.

6
00:00:20,440 --> 00:00:28,180
So coming into our value here, we're going to create a new variable and using a boolean of false,

7
00:00:28,390 --> 00:00:29,860
we're going to set up two false.

8
00:00:30,750 --> 00:00:38,100
And then down here, we're going to check to see if the move is true and if it is true, then we want

9
00:00:38,100 --> 00:00:39,390
to move our wings.

10
00:00:39,870 --> 00:00:42,360
So we're going to take our wing position.

11
00:00:43,020 --> 00:00:47,120
And that means that we also need to set that when we're building out that object as well.

12
00:00:48,290 --> 00:00:55,100
So we're setting a default wing position, so using the same object, that element object, we can set

13
00:00:55,100 --> 00:00:56,980
various data values within it.

14
00:00:57,530 --> 00:01:00,160
So we're going to set our wing position to 15.

15
00:01:01,550 --> 00:01:10,010
And we'll also set the style value of it, as well as a style top and equal that to the wing position

16
00:01:10,430 --> 00:01:11,930
plus PEX.

17
00:01:12,950 --> 00:01:19,040
So that everything aligns and now where we want to move the wing, we can take that same object.

18
00:01:19,050 --> 00:01:28,970
So setting our wing position value and we can take wing position and check to see if it's equal to 15.

19
00:01:29,630 --> 00:01:32,330
And if it is, then we're going equal to 20.

20
00:01:32,990 --> 00:01:39,800
And if it's not, then we're going equal to 15, seizing a territory operator and then taking our wing

21
00:01:39,800 --> 00:01:41,750
style top.

22
00:01:42,170 --> 00:01:47,800
So just as we were setting the bird position, we're going to use updating the property.

23
00:01:48,050 --> 00:01:54,400
So taking our wing position and then don't forget to add in the pics in order to set it.

24
00:01:54,740 --> 00:02:01,700
So now every time we want to have wing movement, we take move and we set up to try to going through

25
00:02:01,700 --> 00:02:02,090
here.

26
00:02:02,270 --> 00:02:07,550
And if it's true, so it doesn't matter which key is pressed, it doesn't matter how many keys are pressed,

27
00:02:08,090 --> 00:02:08,750
we're going to get there.

28
00:02:08,750 --> 00:02:15,520
And I just realized that this is not sitting within the correct function, so that's why it wasn't working.

29
00:02:15,800 --> 00:02:16,670
So let's try that again.

30
00:02:17,570 --> 00:02:21,710
So now whenever I, I press the key, you can see the wings are moving.

31
00:02:22,460 --> 00:02:25,370
They're moving really fast because my movements really fast.

32
00:02:25,650 --> 00:02:29,720
Well, you can see that the wings are not static anymore, that it is moving up and down.

33
00:02:29,960 --> 00:02:33,800
And if you want to actually increase the movement, you can do that as well, where you could increase

34
00:02:33,800 --> 00:02:34,490
it to 20.

35
00:02:34,730 --> 00:02:36,910
So it'll go from 15 to 20.

36
00:02:37,370 --> 00:02:39,850
So it's a little bit more of a drastic movement.

37
00:02:40,250 --> 00:02:44,820
So whatever your preferences, you can adjust this and make the adjustments as needed.

38
00:02:45,080 --> 00:02:50,720
So now every time one of the arrow keys is pressed, we see that we're getting the movement taking place.

39
00:02:51,440 --> 00:02:57,200
And there's one other thing that I want to add before we conclude this lesson, and that's adding in

40
00:02:57,200 --> 00:02:58,100
the space key.

41
00:02:58,400 --> 00:03:04,310
So I want the space key to do the same thing as the up arrow that it's going to move it up.

42
00:03:05,270 --> 00:03:10,080
So let's add in one more here where we've got heat and space.

43
00:03:10,640 --> 00:03:14,440
So if either one of those is true, then that's going to be true.

44
00:03:14,990 --> 00:03:15,980
So it's going to move it up.

45
00:03:16,550 --> 00:03:22,940
So now if I press space or if up arrow and obviously can't see my keyboard, but you have to take my

46
00:03:22,940 --> 00:03:27,620
word for it that I'm pressing space, I'm pressing up Arrow and it's doing the same functionality.

47
00:03:27,860 --> 00:03:29,240
So the player now has a choice.

48
00:03:29,420 --> 00:03:36,350
They can plus the space or they can play the up arrow and both of them will move the character up on

49
00:03:36,350 --> 00:03:36,770
the screen.

50
00:03:37,340 --> 00:03:42,980
So coming up next, we need to add in some default drag to drag the character down, because this is

51
00:03:42,980 --> 00:03:46,430
going to be gravity and it's going to constantly be pulling the bird down.

52
00:03:46,560 --> 00:03:51,800
So he has to keep flapping his wings in order to stay afloat and stay up in the air.

53
00:03:52,310 --> 00:03:53,420
So I'm not sure how to do that.

54
00:03:53,420 --> 00:03:54,620
Coming up in the next lesson.
