Hi guys.
Just playing around with Tilesheets I found something that I believe is interesting to mention ( It tooks me more than 4 hours to discover it ). Not very sure if it could be considered a bug, but width and height of a sprite throws wrong values when compiling in html5 if you use tilesheets inside them. In flash it behaves like the flahs coders expect to behave
If you want some extra information just let me know and I will try to recreate the problem in a simple example .
Regards
Luis
I think in HTML5, it makes the canvas the size of the full project size, and does not try to perform a bounds calculation. Perhaps it should, though I was concerned of losing performance to iterating through all the objects in the array and calculating size, and perhaps (wrongly) making the canvas smaller/larger repeatedly over time. On the other hand, this shouldnāt necessarily effect the ālogicalā size of the object, this could be calculated and retained, at least at render time, I think. This would be good to keep track of, at least in a simple sample of something thatās failing to behave as expected
Yes it makes it as the size of the project, but only if you use Tilesheets.
At first I created my graphic object using Bitmaps as childs (wiith copyPixels ) and everything behaves in the same way compiling for flash and for HTML5.
When I started using Tilesheets the sprite become 800x600 when compiling with HTML5.
Been trying without success to understand what was happening and I find this post.
So, thereās no solution for this when using Tilesheets in html5?
Open to suggestions
The Graphics class in HTML5 calculates itās size based on the instructions, in the interests of performance, drawTiles uses a full-screen sized canvas so that it neither grows nor shrinks in size, and so we donāt make a calculation against all the tile data in the array
Oh, Iām a total noob about this and didnāt know.
Thanks for clarifying.
Ended up using a solution where I map the tile I need into a new bitmapData object and using it as a bitmapFill, when using the html target. Worked nice (at least for now :P).