Exemplo n.º 1
0
        /// <summary>
        /// Translates the x and y coordinate on the gamemap into the actual
        /// tile
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void PointToTile(float x, float y, TileHelper tileHelper)
        {
            //float width = height;//weird huh?
            //col = (int)(x / width);
            //if (col % 2 == 0)
            //    row = (int)(y / height);
            //else
            //    row = (int)((y - height / 2) / height);

            ////Find the test area
            //float testx = col * width;
            //float testy = row * height;
            //if (col % 2 == 1) testy += height / 2;


            this.selectedTileStruct.x    = (int)(x / this.height);
            this.selectedTileStruct.y    = (int)(y / this.height);
            this.selectedTileStruct.tile = tileHelper.GetTile(this.selectedTileStruct.x, this.selectedTileStruct.y);
        }