I'm trying to create a simple rogue-like game in ncurses in a C program.
The idea here is that, I'd parse a file like this:
10X10 ds2 de2 dw5 12X12 ds3 de2 dw1 14X14 ds5 de1 dw5 10X10 ds5 de3 dw5 12X12 ds5 de2 dw5 14X14 dw2 de1 ds2
Where the first number is a door size(rows,columns), the second string being a door, where s = south, w = west, etc, so ds2 = door south 2 down (in the y direction).
Effectively, this looks like this when parsed, I have this:
Where (hopefully viewable), the plus signs at the end of each room, are the doors that lead to another room, so in the first room, the east door would lead to the room to the right, etc.
However, this is where I'm not sure how to go about implementing my logic. I need to make it when I step on a plus sign "effectively" a door, I'd teleport the player (the @ sign cursor) to the correct door.
Okay, great I know the locations of each doors, but how would I actually mvoe the cursor to the next room.
I can't simply hard code the distance between two rooms, as that's just ineffective and would take too long.
Just to clarify, what I mean about teleporting: See this picture:
Where the user "@" symbol would move to the door (in the first room), then get teleported to the second room (12x12 room). (AS seen in the next picture) (Again where the @ symbol is the user, moving the cursor around (w,a,s,d).
So to clarify: I need a way to move a cursor, between two rooms, without hardcoding the distance between rooms, unless there is an effective way to hard code the distances.