![]() |
|
making scrolling and character movement work.. |
red-dragon
Member #7,722
August 2006
|
Ok, I have some code here. I've never done this before. I'll start slow. Variables/predefined processors etc. you should know:
Problems with this: An error occurs when you try to go all the way up. You start at the bottom, you go up and the map changes fine, then you try to go up once more, and instead of map change, the error occurs and app. has to be closed. I think I know why this is. I'm not sure I understand all of the math, I tried to follow the book: I also realize that if say, if(scrollx < 0) scrollx = 0 holds TRUE, then link still changes position. I'd like to change this after the above problem is solved. Basically, I'm really stuck here. I've tried a couple of things (which I'd rather not mention here, since those details might be confusing). I"m just looking to get rid of that error, and fix the 2nd problem I've mentioned. I REALLY need the help, I'd really appreciate it. TIA. P.S. I realize the code isn't necessarily clean, I appologize. |
piccolo
Member #3,163
January 2003
![]() |
it crashing because you are not checking to see if the view screen is at the top of your world. i dont get why you set y to 0. i use scrolly ++; and y++; wow |
red-dragon
Member #7,722
August 2006
|
hey piccolo, I'll explain how I'm doing this: I simply say, if (link->y < 0), so if the user has pressed up to the point where link is on very top edge of screen (0,0 is on top left in allegro, right?), then two things should happen: Either way, I'm curious why the scrollx works by scrolly is giving me the problem. p.s. I set y to zero so he appears at top of screen..? I might be missing your point here. |
piccolo
Member #3,163
January 2003
![]() |
i see now i would have did the link game a little different . but try this i think this will fix your bug. edit: sorry for untimely reply allegro did not email me??? wow |
red-dragon
Member #7,722
August 2006
|
hey piccolo, I have tried your second suggestion, but to no avail. I'm gonna upload my dev project here so that you might feel free to mess around (or anyone really). Yeah, code isn't clean, comments are all over.. go to movelink() and at the bottom is the piece of code that I've posted here. Here's the zip file for the project. Keep the inputs coming, I'm a bit desperate to solve this 'bug'. |
piccolo
Member #3,163
January 2003
![]() |
hey im still looking at your code it seems to be doing the area[][] thingy i was talking about. but i don't see the where the tile are put together to make the maps areas. if this is your first game i don,t think it a nice way to lern allegro because you don't see graphics i leaned allegro with this site use the rpg Examples they also have a Zelda clone.http://agdn.netfirms.com/main/ take a look at it while i check out you bug if you want to. Edit: ok heres the changed code
you sound like you learn just like me so check out that site i gave you it really got me started. you can check out my game as well it in c++ mvsc6 http://www.allegro.cc/depot/Thegame/ wow |
red-dragon
Member #7,722
August 2006
|
piccolo, I'm using a map made in Mappy. I'm using mappyal.c/.h...so I load map1 like this: MapLoad("map1.fmp"), and then to draw the map, I call MapDrawBG. I found the tutorial you're talking about and will look into that tomorrow. I just refuse to believe that noone else has done it the way I'm talking about or doesn't know what I'mtalking about. It's late at night and I can only hope that when I check this thread in the morning, a couple more people will weigh in on this matter. Even if they are just ideas! Piccolo, your idea is not bad; but that'd mean leaving this matter unresolved..... and i'd HATE to do that, heh. It's kind of eating away at me. C'mon peeps, pop on in here |
piccolo
Member #3,163
January 2003
![]() |
did you try the code i posted it fixes your bug.??? wow |
red-dragon
Member #7,722
August 2006
|
Aw, hey piccolo, |
piccolo
Member #3,163
January 2003
![]() |
ok now i see what you mean could you give me the link to the program you use to look inside the map1.fmp file. i need to know how big the map real is and how much of it your grabbing for each map area. what could be happening is your grab to much each time . so when you want to grab again there not enough to make a full screen. that will look like this. 9999999999 45629 and when you try to go up again you try to grab the next 3 rows but there are only 2 row left 99999 [edit] i just found the program and it seems that my guess is right wow |
red-dragon
Member #7,722
August 2006
|
piccolo, Anyway, it wasn't my map, it came with the author's tutorial... so other than making sure that the map is the perfect size.. there's not much I can do, eh..? I'll be waiting for your reply, Piccolo. EDIT: So, I changed height of map to 30 tiles. 30*32 (32 = tilewidth) = 960. 960-480 = 480; 480-480 = 0. SO, that starts working, but when I hit the top bottom edge of map, an error pops up with error message. I even get a weird horizontal scroll error. |
piccolo
Member #3,163
January 2003
![]() |
ok heres the error change #define MAP_DOWN 33 to its in the link.h around the top wow |
red-dragon
Member #7,722
August 2006
|
piccolo, I'm thinking of doing it with the arrays. I'm looking at the rpg tutorial that you gave me the link to piccolo.... have you followed it? Link Anyway, here the tutorial mentions DATAFILE *data... wth is that?? Lastly, we have load_map() code:
How do you make a map and save it as map1.dat? Can you do that in Mappy (this is the only map editor I know...)... plus, what does "rp" mean?? |
piccolo
Member #3,163
January 2003
![]() |
yeah take a look at my game wow |
|