Hello and welcome to another episode in the Godot basics tutorial series. In this episode we will be taking a look at a basic concept about wraparound games. So a wraparound game is a game where space is finite and game objects are unbounded. The most famous example would be the game Asteroids. In this game you have a ship and rocks floating on the screen. And what makes this game unique is that when a game object reaches the edge of the screen it will instantly teleport to the opposite side of the screen and vice versa.
The same will be true for the top and bottom portion of the game screen as well. And so let's take a look at an example in this case we have our game object Pikachu moving to the right and just as we are approaching the edge of the screen. Notice how our game object is cutting past the screen and we won't teleporter game object until our offset touches the maximum width or minimum width of the screen. And so when our game object reaches the maximum width of our screen we instantly teleport our game object to the opposite side of the screen and that's basically the basic concept of a wrap around game.
In regards to game objects. And this is just moving to the right. If we move to the left it will be the same thing when we reach the edge of the screen we instantly teleport to the opposite side of the screen. And so the homework is to create a wraparound effect to get the most benefit. Take your project file from the last homework assignment and add onto it. In this homework assignment. So this is a little vague. Let me break down the two basic concepts for the homework assignment. The first is when your game object exceeds the right side of the screen.
In this case when it exceeds the maximum width of your screen change your game objects x position to zero and vice versa. So if your game object were to have a position of X lower than zero then just instantly change its position to the maximum width of the game screen. Although in both of these cases you don't want to give the exact value and so it's easier if you add one to zero and minus one from the X Max when switching sides depending on how you code.
And of course you want to do the same thing for the y position of your game object. So basically if your game object exceeds the bottom side of the screen change it's y position from Y Max to zero and vice versa depending on how you code you most likely want to change the position by minus one from the maximum height of your game screen or add one to the value of zero again depending on how you code your project. Well that's all I have for you in this episode and the next episode we'll take a look at a solution to the game concept of a wrap around the game.
Thank you so much for subscribing and thank you so much for clicking the Like button if you have any questions or comments please feel free to leave them in the comments section down below. I look forward to seeing you in the next episode. Have an amazing day