Hi all.
I would like to learn how to convert text files in map walls, to build something like the classic Pacman.
I found some games written in Love2d/Lua, but I need a deeper explanation about how the conversion works,
Where can i find some step by step tutorials about that process?
Thanks!
Convert text file to map wall
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Convert text file to map wall
Hi and welcome to the forums!
Not sure where tutorials would be, but this in and of itself is not too hard of a problem.
You open a file, you read in contents, you iterate over contents and parse them however you want to. (there are multiple ways to read in a file though, and i'm not even going to talk about different encodings)
You have a text file with symbols that you previously agreed on what will function as what (wall, power pellet, normal pellet, spawn point, etc.), then you read in the file with love.filesystem.lines for example, and then go through each character, and build up the world in some form; usually you'd either want to put all "tiles" into one table, and use math to get the x and y coordinates, or use a table of tables (basically a "2D" table) for less math.
Everything else depends on the game implementation.
Not sure where tutorials would be, but this in and of itself is not too hard of a problem.
You open a file, you read in contents, you iterate over contents and parse them however you want to. (there are multiple ways to read in a file though, and i'm not even going to talk about different encodings)
You have a text file with symbols that you previously agreed on what will function as what (wall, power pellet, normal pellet, spawn point, etc.), then you read in the file with love.filesystem.lines for example, and then go through each character, and build up the world in some form; usually you'd either want to put all "tiles" into one table, and use math to get the x and y coordinates, or use a table of tables (basically a "2D" table) for less math.
Everything else depends on the game implementation.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: Ahrefs [Bot] and 10 guests