Ok, so I'm trying to implement mappy collision detection. Right now I have a damn ugly map, with 4 borders. These borders, Link shouldn't be able to walk on. The top and bottom borders are made of the exact same ugly grey tile, and left and right borders are made of some ugly brown tile.
So, for those two tiles, I opened this 'map' in Mappy, double-clicked on each of the two tiles, and set all 4 flags for collision detection. To my understanding, they are tl, tr, bl, and br.
So, I have this code within my program:
int collided(int x, int y)
blockdata = MapGetBlock(x/mapblockwidth,
So before Link walks N, S, E, W, I check for collision with the above code. If above code returns false, as in, no flags have been set, then Link can move in that direction. So, here's relevant code:
|4|| case 1:|
|5|| if(!(collided(link->x - num1, link->y)))|
|6|| link->x -= num1;|
|10|| case 2:|
|11|| if(!(collided(link->x, link->y-num1)))|
|12|| link->y -= num1;|
|16|| case 3:|
|17|| if(!(collided(link->x + num1, link->y)))|
|18|| link->x += num1;|
|22|| case 4:|
|23|| if(!(collided(link->x, link->y+num1)))|
|24|| link->y += num1;|
This seems really simple. This works for top and left border, but NOT for the right and bottom borders. Maybe I've misunderstood the flags...? Can someone please help me understand what I might be doing wrong? TIA.
p.s. Two semi-weird problems I'm experiencing using mappyal. One, if map is made of 8bit tile, and I hit esc, I exit fine. If I'm using a 24bit one, when I exit by hitting esc, I get an error message. Second problem is.. I've set my Link sprite's background color to magenta (r=b=255, g=0) for transparency. Yet, when program runs, the magenta part switches from all black to weird lines. Any explanations?