Are you ready to move the wings of the bird and we saw that we can move the character around depending
on the key process.
Now let's add in the ability to move the wings.
So we want the wing movement to take place every time one of these keys is being pressed.
But we don't want to take place if it's not being pressed.
So coming into our value here, we're going to create a new variable and using a boolean of false,
we're going to set up two false.
And then down here, we're going to check to see if the move is true and if it is true, then we want
to move our wings.
So we're going to take our wing position.
And that means that we also need to set that when we're building out that object as well.
So we're setting a default wing position, so using the same object, that element object, we can set
various data values within it.
So we're going to set our wing position to 15.
And we'll also set the style value of it, as well as a style top and equal that to the wing position
plus PEX.
So that everything aligns and now where we want to move the wing, we can take that same object.
So setting our wing position value and we can take wing position and check to see if it's equal to 15.
And if it is, then we're going equal to 20.
And if it's not, then we're going equal to 15, seizing a territory operator and then taking our wing
style top.
So just as we were setting the bird position, we're going to use updating the property.
So taking our wing position and then don't forget to add in the pics in order to set it.
So now every time we want to have wing movement, we take move and we set up to try to going through
here.
And if it's true, so it doesn't matter which key is pressed, it doesn't matter how many keys are pressed,
we're going to get there.
And I just realized that this is not sitting within the correct function, so that's why it wasn't working.
So let's try that again.
So now whenever I, I press the key, you can see the wings are moving.
They're moving really fast because my movements really fast.
Well, you can see that the wings are not static anymore, that it is moving up and down.
And if you want to actually increase the movement, you can do that as well, where you could increase
it to 20.
So it'll go from 15 to 20.
So it's a little bit more of a drastic movement.
So whatever your preferences, you can adjust this and make the adjustments as needed.
So now every time one of the arrow keys is pressed, we see that we're getting the movement taking place.
And there's one other thing that I want to add before we conclude this lesson, and that's adding in
the space key.
So I want the space key to do the same thing as the up arrow that it's going to move it up.
So let's add in one more here where we've got heat and space.
So if either one of those is true, then that's going to be true.
So it's going to move it up.
So now if I press space or if up arrow and obviously can't see my keyboard, but you have to take my
word for it that I'm pressing space, I'm pressing up Arrow and it's doing the same functionality.
So the player now has a choice.
They can plus the space or they can play the up arrow and both of them will move the character up on
the screen.
So coming up next, we need to add in some default drag to drag the character down, because this is
going to be gravity and it's going to constantly be pulling the bird down.
So he has to keep flapping his wings in order to stay afloat and stay up in the air.
So I'm not sure how to do that.
Coming up in the next lesson.