Terrain mapping problem
I am working on my RTS engine in DirectX, and for some reason the terrain mapping is not quite working correctly. When the terrain graphics are displayed, it shows a map full of grass, and then a lake of water in the middle. However, even though it displays the water in the correct spot, it treats it like it is one tile to the left of where it really is, so the collision detection is really messed up.
Has anyone had a problem similar to this and know what could be causing the problem?
I dont have my code on me right now...but if you need it, I can post it tomorrow from school.
I had this problem myself when working on my dos terrain scroller. Instead of scanning tediously throught my source for the origanal error i made a quick fix for it.
Heres the idea i keep, i dont care how offset the graphics are from there intended position as long as it looks good and the inner code works.
That means if i intended a tile to show up at a coordinate of 2,5 and it shows up at 1,4 as long as everything else is offset that way, and the code still does what it was intended *collision detection* then thats fine.
So what i did, was added 1 to each coordinate when collision detecting.. so when it was supose to be checking 2,5 it was really checking 2,4 *graphicly*
If you get what i mean.
When i outputed my character it was one too many to the right *graphicly*
so i quick fixed it with this:
// draw me
x++; // cancel out // graphicly adjust for offset problem.
if (y == MyYv)
if (x == MyXv)
x++; // normally done
x--; // cancel out
i hope this helps you get an idea for a fix.