Timeline for Tiled object layer draw sprites
Current License: CC BY-SA 3.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 21, 2021 at 0:01 | comment | added | DataMania |
This method worked for me, but I had to scale it from mapObject's scaleX and scaleY properties and texture regions width and height. Like this in Kotlin: batch.draw(mapObj.textureRegion, mapObj.x, mapObj.y, mapObj.textureRegion.regionWidth * mapObj.scaleX, mapObj.textureRegion.regionHeight * mapObj.scaleY)
|
|
| Jul 10, 2015 at 13:42 | comment | added | Richard H | @Rouze Works now with textureObject.getProperties()! Thank you :) | |
| Jul 10, 2015 at 13:33 | comment | added | driima |
@RichardH I'm unsure then. Perhaps you can check textureObject.getProperties() for width and height properties? As far as I am aware, libGDX does deserialize this data.
|
|
| Jul 10, 2015 at 13:16 | comment | added | Richard H | @Rouze I tried that aswell but it only gives me the default region width but not scaled.. | |
| Jul 10, 2015 at 12:43 | comment | added | driima |
@RichardH Perhaps textureObject.getTextureRegion().getRegionWidth() and textureObject.getTextureRegion().getRegionHeight() would be of some use?
|
|
| Jul 10, 2015 at 4:39 | comment | added | Richard H | I tried to use getScaleX() and getScaleY() but they both return 1 | |
| Jul 9, 2015 at 21:42 | comment | added | driima | @ThorbjørnLindeijer ahh, I haven't updated in a while, so I didn't know about these new features! Thanks for the information. | |
| Jul 9, 2015 at 21:30 | comment | added | Thorbjørn Lindeijer | I just want to say that while indeed tile objects can be used as spawn indicators, using them for actual visual decoration of the map is totally fine and also an expected use-case. It is why in since Tiled 0.10 you can rotate these objects and since Tiled 0.12 they are also resizable. | |
| Jul 9, 2015 at 21:28 | comment | added | driima |
@RichardH Check out TextureMapObject, it contains methods getScaleX() and getScaleY() which may be of use to you, but I am not entirely sure of their reliability.
|
|
| Jul 9, 2015 at 21:25 | vote | accept | Richard H | ||
| Jul 9, 2015 at 21:19 | comment | added | Richard H | Thank you! ... this is very helpful, but I got a new little problem... I get everything drawn now, but I scaled my sprites and I need to get the scale in code for the right resize of the sprite... I use normal rectangle map objects to spawn entities ;) | |
| Jul 9, 2015 at 21:01 | history | edited | driima | CC BY-SA 3.0 |
added 591 characters in body; edited body
|
| Jul 9, 2015 at 20:43 | history | answered | driima | CC BY-SA 3.0 |