> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/tiled-plugin/flatredball-tilegraphics-mapdrawablebatch/painttiletexturecoordinates.md).

# PaintTileTextureCoordinates

### Introduction

PaintTileTextureCoordinates can be used to change the texture coordinates on a tile by its ordered index. This method can specify all four coordiantes (left, top, right, bottom) or just the top and left. If only the top and left are specified, the bottom and right are automatically determined based on the tileset's tile dimensions.

### Code Example

Note that this requires the ordered tile index. This sample assumes that tiles have been added manually, and then painted later.

```lang:c#
// assuming map is a valid MapDrawableBatch:

var position = new Vector3(0,0,0);
var size = new Vector2 (16, 16);

// Note that AddTile uses pixels for the texture...
var index = map.AddTile(position, size, 0,0, 16, 16);

// now the index can be used to paint a different texture coordinate.
// Note that this uses texture coordinates not pixel coordinates:
// Here we use consts for the texture size to keep things simple but
// your code should use your actual texture size.
const float textureWidth = 1024;
const float textureHeight = 1024;
map.PaintTileTextureCoordinates(index, 32/textureWidth, 32/textureHeight);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flatredball.com/flatredball/tiled-plugin/flatredball-tilegraphics-mapdrawablebatch/painttiletexturecoordinates.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
