I have a top down game and i just want to know how to make it so when the character hits the right side he will go to the right map/level. I feel like this is a basic necessary part of a lot of games so i don't know how nobody has a tutorial or guide for this. I would be so grateful for anyone that can help. I know this isn't alot of info so just comment if you want more info. Basically just how can you make an almost rpg style movement between maps?
As @Batman stated in the comments of your other question, this is a pretty broad question and you have multiple ways to accomplish this.
I will tell you about one possible approach, or rather, what you need to learn to accomplish something like this. As a side note, you seem to be a beginner, so maybe you should try to do easier stuff first, because this is a fairly complex topic.
You need a 2 Dimensional Array that contains rooms (or rather, the data of the rooms), which in effect is something like a table
each of these rooms has a row
and a column
to identify their position
You need to be able to tell in which position the player has left a room, left
, right
, up
, down
You need to be aware in which room the Player is located (through the aforementioned row
and column
ids of the room)
According to the direction of the player, you need to load the room with the corresponding row
and column
identifiers. For example, if you move to the left
, you should decrease the row identifier of the player location. If you move up
, you should decrease (depends on the orientation of your table) the column identifier and so on. These updated variables will tell you which room you need to show next