Online users ( Unknown) |
Application object not working properly at the moment, no clue who is online... * Numbers in parentheses are the number of minutes since the user last loaded a page. Logged-in users time out after 40 minutes (unless they manually log out), lurkers and anonymous posters after 20. |
Locke Registered user Treasure hunter Last page view: 7909 days, 10 hours, 52 minutes and 19 seconds ago. |
For anyone (Stas? :)) who's having a lil prob fixing a corridor generator for their RL-game, here's some ideas that can help. In my RL-game (which progress has stalled for the time being)I have a corridor generator that, atm, can generate straight, horizontal and vertical corridors. First of all you need the starting point of the corridor (sx and sy), length of the corridor (len), type of corridor (type), and possibly color of corridor walls and floor (though I handle colors by giving type of tile in my RL). Here's a bit of code on how the corridor generator can look like (I'll use C code style since I am fairly familiar with it): void gen_corridor(int sx, int sy, int len, int type){ int x, y; if (type == HORIZONTAL){ for (x = 0; x < len; x++){ set_tile(sx + x, sy, FLOOR); set_tile(sx + x, sy - 1, WALL); set_tile(sx + x, sy + 1, WALL); } } if (type == VERTICAL) { for (y = 0; y < len; y++){ set_tile(sx, sy + y, FLOOR); set_tile(sx - 1, sy - y, WALL); set_tile(sx + 1, sy + y, WALL); } } } In theory: Step <len> times in appropriate direction (horizontal, vertical, etc). For each step, set floor tile at current position and wall tiles next to the floor tile. Repeat until <len> has been reached. The code example above might not be the most efficiant one on earth. In fact, I just now got an idea on how to slim the code a bit. Another note: As I wrote that code example on the fly, with no test-compiling whatsoever, I can not guarantee that it'll work as planned. I am sure that there will be modficiations made to it if you decide to try it out in your own RL. And finally: Do as you like with it, and if you feel like it, add my name to your thanks to list. :) Good luck! Locke Cole |
||
Stas Registered user The Dark Lord Melkor Last page view: 7661 days, 23 hours, 31 minutes and 20 seconds ago. |
well, i tried that BUT: that code doesn't "look around", I mean it doesn't check are there walls or doors or floors on its way, or near it... So that could result: ###X... #...# #...# #...# ##### X is ending/starting point, floor... gimme your email, I'll post you what I have done for the time... I use djgpp... so there is ScreenPutChar :) "Do not meddle in the affairs of wizards, for they are subtle and quick to anger" Lord of The Rings "Do not meddle in the affairs of cats, for they are subtle and will anger the cat lord" |
||
Locke Registered user Treasure hunter Last page view: 7909 days, 10 hours, 52 minutes and 19 seconds ago. |
Yes I know that the example does not check for walls and such. As it was only an example, I wanted to keep it simple. :) Oh I don't use DJGPP anymore. I use Dev-C++ now. Though I plan to go back to DJGPP when it comes to DOS-based progs. Anyway, email: lockes@telia.com Locke Cole |
||
Stas Registered user The Dark Lord Melkor Last page view: 7661 days, 23 hours, 31 minutes and 20 seconds ago. |
doesn't it already come with DOS based progs? BTW, I saw you in newsgroups... and Jan isn't lurking there anymore (isn't he?)... "Do not meddle in the affairs of wizards, for they are subtle and quick to anger" Lord of The Rings "Do not meddle in the affairs of cats, for they are subtle and will anger the cat lord" |
||
Locke Registered user Treasure hunter Last page view: 7909 days, 10 hours, 52 minutes and 19 seconds ago. |
You mean that Dev-C++ can compile DOS progs? Yes it can but I seem to have some probs with including conio.h and other non-standard libs correctly. Oh he isn't? Ah well, nevermind then. :) Locke Cole |