Thread: Terrain mapping problem

  1. #1
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Plano, Texas, United States

    Question 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.
    My Website

    "Circular logic is good because it is."

  2. #2
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    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.
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  4. Multiple include problem
    By VirtualAce in forum Game Programming
    Replies: 13
    Last Post: 02-04-2006, 06:09 PM
  5. Replies: 5
    Last Post: 11-07-2005, 11:34 PM