Results 1 to 19 of 19

Thread: Iso Engine Mouse Coordinates -[RESOLVED]-

Threaded View

  1. #1

    Thread Starter
    Addicted Member CodeRonin's Avatar
    Join Date
    Jul 2002
    Location
    Vienna, Austria
    Posts
    233

    Resolved Iso Engine Mouse Coordinates -[RESOLVED]-

    Hi there,
    by now, I've finished the graphical display of my Iso Engine.

    I'm saving the Tiles in a 2dimensional Matrix, so my GameField looks like this...

    GameTile GTMAP[10][10] =
    {
    1,1,1,4,1,1,1,1,1,1,
    1,1,1,1,1,1,1,1,1,1,
    1,1,1,1,1,1,1,1,1,1,
    1,1,2,3,4,1,1,1,1,1,
    1,1,1,2,3,1,1,1,1,1,
    1,1,2,1,6,1,1,1,1,1,
    1,1,1,1,1,1,1,1,1,1,
    1,1,1,1,1,1,1,1,1,1,
    1,1,1,1,1,1,1,1,1,1,
    1,1,1,1,1,1,1,1,1,1,
    }

    Where every number stands for a different type of terrain (not hardcoded, of course).

    Now, my question is: Given a paoint X(x/y) on the map (a mouse coordinate, to be precise), how can I check which tile I am in?

    Since it's not standard rectacular, a normal division by height and width won't work, so my attempt was to first do the normal division to know where about i am, seperate the most likely tile into four triangles, use the formula y=kx+d for linear functions and get the max for my y coordinate this way...

    Unfortunately, that's too slow...
    Any ideas on how to do it?
    Last edited by Electroman; Nov 14th, 2004 at 05:37 PM.
    Code Ronin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width