关于贴图坐标的,我英语不好,有点费解,那位大侠帮忙翻翻看!谢谢!This is where those math classes you took come in handy. Finally, functions are really useful. (And, I don't mean functions as in programming.) A row of tiles is placed along, or follows, the function f(X)=0.46875X or f(X)=0.46875X depending on which axis. (Why all the decimals? Remember in the last article we used the tile height of 30, which divided by 64 is 0.46875. If we use 0.5 instead, which doesn't seem to be too much different, we will get a slight deviation in the positioning system. The cursor will start selecting tiles beside it, in some cases as many as three tiles in the wrong direction.) The X in these function refers to the screen coordinate system. These two functions look like this:
图1
The shaded area is a value above and below the function that the tile is within. Where two shaded areas cross each other we have the shape of a tile. What we have to do in order to figure out which tile the cursor is in is to determine when the tile is inside the shaded area. So, if the Y value of the cursor is between -0.46875X+14 and -0.46875X-14 then the cursor is on the same WorldY as the tile. If the Y value is between 0.46875X+14 and 0.46875X-14 then the cursor is on the same WorldX as the tile. If both these happen at the same time then the cursor is on the tile (where the shaded areas cross). This is just for one tile. What about 100x100 tiles? This picture might give you an idea of how to solve this.
图2
First of all, every row is offset one tile height (30 pixels) from the one above. So, what we do is enumerate through all WorldX rows until we strike the right one. Then we take the number of that row and place it in the TileX Integer. Next, we enumerate through all the WorldY rows and place the right number in the TileY Integer. Finally, we return the two values to the main program. Now, the main program can use these values to get tile info, draw the er, etc. Ok? Let's implement it in our tiling engine.

解决方案 »

  1.   

    别动不动就是钱,我主要是把它翻译给大家看的,其实我自己都能看懂,但是怕我翻的不够准误导了大家,确所以才请大家看看怎样翻的好。这还长,我一个小时翻译了6倍长的文字也没喊长吗!不会翻就不要乱法帖,CSDN就是被你们这些人搞的乌七八糟的!现在CSDN哪有学术气氛啊!
      

  2.   

    哈哈,金山快译2003:This is where those math classes you took come in handy.
    这是那些数学分类的地方你轮流受到在的影响便利的。 Finally, functions are really useful.
     最后,功能真的有用。 (And, I don't mean functions as in programming.)
     (AND, 我不意谓功能当做在程序规划中.) A row of tiles is placed along, or follows, the function f(X)=0.46875X or f(X)=0.46875X depending on which axis.
     一个砖瓦的列被放置向前, 或跟随, 功能 f(X)=0.46875 X 或 f(X)=0.46875 X 仰赖桥。 (Why all the decimals?
     ( 为什么所有的十位? Remember in the last article we used the tile height of 30, which divided by 64 is 0.46875.
     在我们用砖瓦画面高度的最后一个文章中记得 30,64 之前分开是 0.46875. If we use 0.5 instead, which doesn't seem to be too much different, we will get a slight deviation in the positioning system.
     如果我们改为使用 0.5, 这似乎不是太多不同的,我们将会得到定位系统的一个微小的偏向。 The cursor will start selecting tiles beside it, in some cases as many as three tiles in the wrong direction.)
     光标将会启动选择在它旁边的砖瓦, 在一些外壳中错误的方向多达三块砖瓦.) The X in these function refers to the screen coordinate system.
     这些功能的 X 提及荧屏坐桥系统。 These two functions look like this: 这二个功能看起来像这一样:
    图1图 1
    The shaded area is a value above and below the function that the tile is within.
    阴暗的区域在和上面功能下面是一个数值砖瓦在里面。 Where two shaded areas cross each other we have the shape of a tile.
     哪里二个阴暗的区域交叉的彼此我们有砖瓦的形状。 What we have to do in order to figure out which tile the cursor is in is to determine when the tile is inside the shaded area.
     我们必须为了要理解光标是哪一砖瓦 , 做的在是决定当砖瓦在阴暗的区域里的时候。 So, if the Y value of the cursor is between -0.46875X+14 and -0.46875X-14 then the cursor is on the same WorldY as the tile.
     如此,如果光标的 Y 数值是在 -之间0.46875 X+14 和 -0.46875 X-14 然后光标在如同砖瓦一般的 WorldY 上。 If the Y value is between 0.46875X+14 and 0.46875X-14 then the cursor is on the same WorldX as the tile.
     如果 Y 数值然后是在 0.46875 X+14 和 0.46875 X-14 之间光标在如同砖瓦一般的 WorldX 上。 If both these happen at the same time then the cursor is on the tile (where the shaded areas cross).
     如果两者的这些然后同时发生光标在砖瓦上.(阴暗的区域越过哪里) This is just for one tile.
     这对一块砖瓦是正直的。 What about 100x100 tiles?
     100 x100 砖瓦怎么样? This picture might give you an idea of how to solve this. 这一个照片可能该如何解决这给你一个主意。
    图2图 2
    First of all, every row is offset one tile height (30 pixels) from the one above.
    首先,每个列在上面被弥补来自那一个的一个砖瓦画面高度 (30个图素) 。 So, what we do is enumerate through all WorldX rows until we strike the right one.
     如此, 什么我们做是列举过所有的 WorldX 列直到我们袭击一个正确的。 Then we take the number of that row and place it in the TileX Integer.
     然后我们轮流那一个列的数目并且把它放在 TileX 整数。 Next, we enumerate through all the WorldY rows and place the right number in the TileY Integer.
     然后,我们列举过所有的 WorldY 列并且把正确的数目放在 TileY 整数。 Finally, we return the two values to the main program.
     最后,我们归还二个数值给主程序。 Now, the main program can use these values to get tile info, draw the er, etc. Ok?
     现在,主程序能使用这些数值得到砖瓦信息, 画那条线信标器,好的等等? Let's implement it in our tiling engine. 让我们在我们的盖瓦发动机中实现它。
      

  3.   

    This is where those math classes you took come in handy. 
    在这儿你所学的数学方法能派上用场。
    Finally, functions are really useful. 
    终于,函数有了用武之地。
    (And, I don't mean functions as in programming.)
    (我不是说是编程中的函数)
     A row of tiles is placed along, or follows, the function f(X)=0.46875X or f(X)=0.46875X depending on which axis.
    一组小图片(tiles)横向,或者垂直排列,取决于函数f(X)=0.46875X 或者f(X)=0.46875X依赖的轴。
     (Why all the decimals? Remember in the last article we used the tile height of 30, which divided by 64 is 0.46875. If we use 0.5 instead, which doesn't seem to be too much different, we will get a slight deviation in the positioning system. 
    (为什么是小数?想想在上一篇文章中,我们使用的图片高为30,用64除就是0.46875。如果我门用0.5代替,看上似乎差别不大,但我们将会发现在坐标上出现轻微的偏移。
    The cursor will start selecting tiles beside it, in some cases as many as three tiles in the wrong direction.)
    光标将选取附近的图片,在一些情况下在一个错误的放向上将有多达三个图片。
     The X in these function refers to the screen coordinate system. 
    函数中的x代表屏幕坐标系统。
    These two functions look like this:
    两个函数入下所示
    图1
    The shaded area is a value above and below the function that the tile is within. 
    阴影区域是图片内比函数值大或小的值域
    Where two shaded areas cross each other we have the shape of a tile.
    两个阴影相交的部分就是我们要的图片的轮廓。
     What we have to do in order to figure out which tile the cursor is in is to determine when the tile is inside the shaded area. 
    要找出光标在那个图片内,将要在图片在阴影区域时进行判断。
    So, if the Y value of the cursor is between -0.46875X+14 and -0.46875X-14 then the cursor is on the same WorldY as the tile.
    所以,如果光标的Y值在-0.46875x+14与-0.46875x-14之间,那么光标就与图片拥有相同的worldy
     If the Y value is between 0.46875X+14 and 0.46875X-14 then the cursor is on the same WorldX as the tile. 
    所以,如果光标的X(Y?)值在-0.46875x+14与-0.46875x-14之间,那么光标就与图片拥有相同的worldx
    If both these happen at the same time then the cursor is on the tile (where the shaded areas cross). 
    如果两者都满足,这光标在图片上(阴影的相交区域)
    This is just for one tile. What about 100x100 tiles? This picture might give you an idea of how to solve this.
    这是一个图片的情况。如果是100*100个图片呢?下图将提示你如何解决。
    图2
    First of all, every row is offset one tile height (30 pixels) from the one above. 
    首先,每一行与上一行的偏移量是一个图片的高度(30像素)
    So, what we do is enumerate through all WorldX rows until we strike the right one.
    所以,我们做得是枚举所有的worldx行,直到找出正确的一个。
     Then we take the number of that row and place it in the TileX Integer.
    然后,我们用图片行序号替代tilex值。
     Next, we enumerate through all the WorldY rows and place the right number in the TileY Integer. 
    接下来,我们枚举所有的worldy行,并替换正确的tiley值。
    Finally, we return the two values to the main program. Now, the main program can use these values to get tile info, draw the er, etc. Ok? Let's implement it in our tiling engine.
    最后,返回两个值到主程序。现在,主程序能用这些值来获得tile信息,绘制标记等等。ok?让我们在我们的tiling引擎中来实现。
      

  4.   

    这是你选的那些数学课用得上的地方。 最后,功能真的有用。 (并且,我不指在编程内起的作用.) 一排瓦片安置向前,或者遵循,功能f(X)= 0.46875X或者f(X)= 0.46875X 依靠, 在那个轴上。 ( 为什么全部小数? 在我们使用瓦片30的高度,那除以的64是0.46875的末班文章内记得。 如果我们改为使用0. 5,这好像不太不同,我们将在这个定位系统内得到一个轻微的偏差。 光标将开始在它旁边选择瓦片,朝着错误的方向有时候象3 片瓦片一样多.) 用这些个功能的X 参考屏幕坐标系统。 这两个功能看起来象这样: 图1 阴影面积高于瓦片是在内的功能和在下面瓦片是在内的功能是价值。 两个阴影面积错过彼此的地方我们有一片瓦片的形状。 为了想出当瓦片是在阴影面积里面时,光标在哪片瓦片里哪个将确定我们必须做的。 因此,如果光标的Y价值是在-0.46875X +14 和-0.46875X-14之间,那么光标在与瓦片相同的WorldY上。 如果Y价值是在0.46875X +14 和0.46875X-14之间,那么光标在与瓦片相同的WorldX上。 如果这两同时发生,那么光标在瓦片(这里阴影面积穿过)上。 这只是为一片瓦片。 100x 100瓦片怎么样? 这图可能让你了解怎样解决这。 图2首先,每排补偿一瓦片高度(30个象素)从在上面的一个人那里。 因此,我们做通过全部WorldX 排列举是直到我们给正确的一个留下印象。 然后我们带那排的数量并且把它安置在TileX整数里。 下一步,我们通过全部WorldY 排列举并且把正确的数目安置在TileY整数里。 最后,我们对主程序返回两价值。 现在,主程序能使用这些价值得到瓦片信息,吸引记分员,等等 Ok吗? 让我们在我们用瓦盖的发动机过程中实现它。 
    在线翻译的~~~
      

  5.   

    kknd74(加隆) 英语不错,佩服佩服,本人斗胆润色润色
    ============
     (Why all the decimals? Remember in the last article we used the tile height of 30, which divided by 64 is 0.46875. If we use 0.5 instead, which doesn't seem to be too much different, we will get a slight deviation in the positioning system. The cursor will start selecting tiles beside it, in some cases as many as three tiles in the wrong direction.)(为什么是小数?想想在上一篇文章中,我们使用的图片高为30,用64除就是0.46875。如果我们用0.5代替,看上去似乎差别不大,但实际上我们将会发现在坐标上出现轻微的偏移。在一些情况下,在错误的方向上有三张图片时,光标将会选择到目标旁边的图片。
      

  6.   

    S.F.(CSDN:896410000) ( ) 厉害厉害
      

  7.   

    http://www.netat.net/
    是个在先翻译站,嗯翻的东西嘛,自己再理解理解应该还可以看的.
    呵呵,各位领导.初来乍到,这厢有礼了.