Now imagine that the bulk of my coding looks remarkably like that (especially when it's the result of 2AM sessions), and you see my problem in figuring out what's going wrong :P
Type: Posts; User: 20,000leeks
Now imagine that the bulk of my coding looks remarkably like that (especially when it's the result of 2AM sessions), and you see my problem in figuring out what's going wrong :P
At the moment, I'm having a bit of trouble with the screen refresher for my very poor Roguelike attempt. Essentially, rather than reprint the entire screen anytime anything changes, I'd like to check...
Try getting your display system up and running first, and then start dealing with map generating... that's how I'm doing it. Instead of randomly generating a map, I load a map file which allows me to...
Hm, dwks told me about vectors in another thread, but I haven't seriously looked into them yet. Perhaps that would be a good idea.... My code is going to get very gluggy for multiple checks. I've...
...well, in just a few short lines you've pretty much done what it's taken me nearly 500 to do. Currently, all my location-relevant things are tied up in one class - like so
class location
{...
Well, you know, it pays to make sure with these things. I really doubt my basic little roguelike will ever be a commercial success (if it got *that* big, I'd release the source so other, less lazy,...
Hm, that seems like a much more efficient way of defining colours... at the moment, I'm using the textcolor() function from the conio headers, but that means if I want to change background colour, I...
Hmm, in that case, a vector may be what I'm looking for. At the moment, I'm limiting the number of items in a position to five, but the check for items depends on the first slot being empty.
I'm...
Well, from the manual and from the guide on this site, curses can only specify eight colours (admittedly it can specify 8 background colours too, so really you've got 56 different colours,...
Well, I'm using the curses header, and now I have to go through my code and remove any conio or windows header references :P.
Still, at least this gives it a poor semblance of portability. And...
Hmmm, I had reset the window to 100x40 (I just checked), because the default was too small... is there any way to set that from within the program?
The window is 100x30...I think. Everything so far has been using those numbers, and they seem to work just fine. While I was using the single-column file-reader, I managed to get a clean display, so...
True. The bigger this thing gets, the more trouble I have finding out what exactly the problem is. I think soon I will have to split it into multiple files...
Still, at the moment I can read a map...
Ah, yes, I noticed that one about five minutes after posting it.... I guess there's an upside to uncomplicated applications, you catch typos faster.
Aha! Problem solved! Thanks a lot, I'd probably have resorted to using a single-column file otherwise....
Hmm, I tried
for ( int i = 0; i < mapy; i++ ) {
for ( int j = 0; j < mapx; j++ )
if (a_file.get()!='\n'){
terrain[j][i] = a_file.get() - '0';
}
else
...
Hmm, it *almost* works. I think because there's a white space on the end of each line, that makes things a little more complex, so I tried:
for ( int i = 0; i < mapy; i++ ) {
for ( int j...
Hmm, thanks for the advice Salem, but it's still not loading correctly :( . Maybe I should figure out how the C commands work rather than mess around with the C++ commands... although the C version...
To be honest, I just prefer it that way.... the main() setup goes something like so:
int main()
{
char mapf[10];
cout<<"Enter map file:\n";
cin>>mapf;
if...
Yet another newbie-ish problem.... this time slightly more advanced.
I'm having a bit of trouble reading information as text from a file.... The information involves three different sets of...
It works! There's a little character that moves around the screen! (only in cardinal directions at the moment, but that's easy to change).
...all that at only 1.24 mb -.-
Efficient, it is not....
Hmm, this is starting to get a bit heavy-going - like I said, I'm not too confident with classes. I understand the basic ideas behind inheritance though, and it sounds like a perfect way to add types...
I like the idea of having types, that sounds much more efficient (and easier for me to figure out exactly what I was thinking when I need to debug). To be honest, I've never seen the enum declaration...
Wow, thanks for your help! I can't say I understand half of your tmaze program, but it's nice to know that it *can* be done.
As to my own efforts, I've tried setting up an overlaying 'object...
Ahhh, that seems to have fixed it! Thanks for your help!
Revised code:
char movedir;
field[charx][chary]='1';
while ((movedir = getch()) != EOF
&& movedir != 'q')...