So we need to add in a few conditions into our gameplay, so notice now whenever we're moving around,
we can actually move the character off of the visible area.
So we want to have some restrictions for that.
So adding in a condition to check to see the value of Player X and ensuring that Player X is greater
than zero.
So adding that condition in will stop the player from being able to move the character off screen.
And you can apply that to all of the different movements so we can restrict where this one is has to
be less than the value of we're going to do this dynamically because in case the player is adjusting
their screen size, we're going to take the value of game area and make this bigger, because this is
turning out to be a fairly long statement and we're going to use that off set with value.
So this is what we saw earlier as well, where we're using these offset values for the left top.
We can also get a width value and subtract 50 off of it.
So that will give us the full right size again, going to increase the speed that the player can move.
So I can show you the different boundaries that we have for the movement.
There's also the up and down values.
So making sure that Y is greater than zero and on the down.
So as we're increasing, we want to make sure that the player X or player Y value is less than in here.
We can use that same game offset width, but we can use the height value and if we want we could subtract
off of it as well.
So offset with some of offset with will use offset height.
So now let's try that.
So now it's created essentially a boundary area that we can't move off of.
So I can see that once I get to the end of the boundaries, I can't move the character off of it.
And that's why on the right side, I did the minus 50.
So technically we should do that for here as well.
We subtract out 50 and then that's going to restrict the ability for the character to move.
Anywhere even close to the bottom, and sometimes you do have to play around and adjust some of the
numbers as needed so you can go ahead and add the boundary and boundary restrictions to your character.
And the one other thing that we want to add in as well is I wanted to have the ability to move the wings.
And we'll take care of that in the next lesson.
So for now, add in the different boundaries on the key movements within your game.