# How can I render Images from an Object Layer?

**URL:** <https://discourse.mapeditor.org/t/how-can-i-render-images-from-an-object-layer/1985>\
**Category:** Questions\
**Created:** [January 25, 2017, 2:43pm UTC](https://discourse.mapeditor.org/t/how-can-i-render-images-from-an-object-layer/1985 "2017-01-25T14:43:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahuvich](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/rahuvich/32/991_2.png) [@Rahuvich](https://discourse.mapeditor.org/u/Rahuvich)\
**Post date:** [January 25, 2017, 2:43pm UTC](https://discourse.mapeditor.org/t/how-can-i-render-images-from-an-object-layer/1985/1 "2017-01-25T14:43:00Z")

</div>

So I am new and I was following a tutorial I saw in youtube. I wanted to draw some images with hitbox, but I wanted to rotate and manipulate those images, so I added them in an Object Layer. Plus I added some Rectangles to set their hitbox.  
I code with Libgdx and when I try to render the map, it only renders the tile layer. so the Images are not rendered, any idea on how to get those images rendered?  
Thank you all!  
I have been searching this for a while and I have not found any answer to this. Sorry for my bad english or my bad knowledge!

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [January 30, 2017, 8:06am UTC](https://discourse.mapeditor.org/t/how-can-i-render-images-from-an-object-layer/1985/2 "2017-01-30T08:06:11Z")

</div>

If libgdx does not implement rendering of tile objects, then you’d need to render them yourself. However, I can’t imagine you’re the first one with this need, so maybe it would help to ask in the libgdx community about this.

---

<div class="post-metadata">

**Author:** ![Rahuvich](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/rahuvich/32/991_2.png) [@Rahuvich](https://discourse.mapeditor.org/u/Rahuvich)\
**Post date:** [January 30, 2017, 7:54pm UTC](https://discourse.mapeditor.org/t/how-can-i-render-images-from-an-object-layer/1985/3 "2017-01-30T19:54:02Z")

</div>

Yeah, I was unaware of this. What I did is:

> public class OrthogonalTiledMapRendererWithSprites extends OrthogonalTiledMapRenderer {

> ```
> public OrthogonalTiledMapRendererWithSprites(TiledMap map) {
> super(map);
> }
> 
> ```

> ```
> @Override
> public void renderObject(MapObject object) {
> if(object instanceof TextureMapObject) {
> TextureMapObject textureObj = (TextureMapObject) object;
> batch.draw(textureObj.getTextureRegion(), textureObj.getX(), textureObj.getY(),
> textureObj.getOriginX(), textureObj.getOriginY(), textureObj.getTextureRegion().getRegionWidth(), textureObj.getTextureRegion().getRegionHeight(),
> textureObj.getScaleX(), textureObj.getScaleY(), textureObj.getRotation());
> if(textureObj.getProperties().containsKey("this")) System.out.println(textureObj.getRotation());
> } else if(object instanceof RectangleMapObject){
> RectangleMapObject rectObject = (RectangleMapObject) object;
> Rectangle rect = rectObject.getRectangle();
> ShapeRenderer sr = new ShapeRenderer();
> sr.setProjectionMatrix(batch.getProjectionMatrix());
> sr.begin(ShapeRenderer.ShapeType.Line);
> sr.rect(rect.x, rect.y, rect.width, rect.height);
> sr.end();
> }
> }
> 
> ```
> 
> }

Because that method was empty. Thank you for the answer!
