Original Post
Alright, I'm completely confused, I've spent many hours pondering this and I cannot come to a solution. Working on an isometric tile engine, and I just can't seem to figure out what's wrong.
This bit of code stops my program. It just STOPS. Locks up completely, can't move, only ways to get out of it are A) Unplug, or B) Hold in the sleep button on my keyboard for 15-30 seconds until the comp goes to sleep, then wake it up and the program is minimized and I can get rid of it.
Now, if you have JUST
(notice the missing scroll.scrolly =... line)
and not the moving in the other three directions, it doesn't die. However, if you put any of those other three, BOOM, death.
I did some tests to check possible causes, and I can tell you this... scroll.camx and scroll.camy can be any integers. There's no value for these that will cause this problem. Similarly, scroll.scrollx and scroll.scrolly can be any integer, with no problems(cept for the fact that it makes my map all funky, but it doesn't crash).
Does anybody have ANY idea what's going on? I had a similar problem before as well, in which you could have any ONE of those four if... statements, but if you have any combination of two of them, it causes instant death. I'm totally lost here.
...By the way, if you take out that code it all runs fine, except of course that the scrolling doesn't work right.
[edited by - Trireme on March 9, 2003 3:40:45 PM]
[edited by - Trireme on March 10, 2003 5:14:53 PM]
if (scroll.scrolly < floor(10 - .5 * scroll.scrollx)) {
//Move to tile up and to the left
if (scroll.camy % 2 == 1) {
scroll.camx = scroll.camx - 1;
}
scroll.camy = scroll.camy - 1;
scroll.scrollx = scroll.scrollx+20; //x offset moves +20
scroll.scrolly = scroll.scrolly+11; //y offset moves +11
}
if (scroll.scrolly > floor(-.5*(scroll.scrollx-10) + 20)) {
//Move to tile down and to the right
if (scroll.camy%2 == 0) {
scroll.camx = scroll.camx + 1;
}
scroll.camy = scroll.camy + 1;
scroll.scrollx = scroll.scrollx-20; //x offset moves -20
scroll.scrolly = scroll.scrolly-11; //y offset moves -11
}
if (scroll.scrolly > ceil(.5*scroll.scrollx + 10)) {
//Move to tile down and to the left
if (scroll.camy%2 == 1) {
scroll.camx = scroll.camx - 1;
}
scroll.camy = scroll.camy + 1;
scroll.scrollx = scroll.scrollx+20; //x offset moves +20
scroll.scrolly = scroll.scrolly-11; //y offset moves -11
}
if (scroll.scrolly < ceil(.5*(scroll.scrollx-10) + 20)) {
//Move to tile up and to the right
if (scroll.camy%2 == 0) {
scroll.camx = scroll.camx + 1;
}
scroll.camy = scroll.camy - 1;
scroll.scrollx = scroll.scrollx-20; //x offset moves -20
scroll.scrolly = scroll.scrolly+11; //y offset moves +11
}
if (scroll.scrolly < floor(10 - .5 * scroll.scrollx)) {
//Move to tile up and to the left
if (scroll.camy % 2 == 1) {
scroll.camx = scroll.camx - 1;
}
scroll.camy = scroll.camy - 1;
scroll.scrollx = scroll.scrollx + 20; //x offset moves +20
}