Hey guys,
Quick question: Is it possible to get a specific picture's width and height value?
Are you asking by the pixel?
Depending on your program, simply multiply the tile size by the map size.
Example: My map is 17x20 and my tike size is 48pixels [Tile size of MV tiles]
So you do 17*48 and 20*48 so your map size becomes 816x960 pixels
By stored do you mean within a plugin as a value?
This probably requires a plugin to do so, because the objects that manage the Pictures dont read any info from the file, they only accept the values of how they will be shown.
They only have the values provided to create the picture, not the values from the original file.
Yup, the width/height plus the scaleX and scaleY are stored and could be retrieved trought script calls. I just dont know exactly how access them though, Im still learning plugin making in MV.
So the engine doesn't actually store that info. You can call the image, but you always have to adjust the image for the game or it may be to big or to small. If the engine did in fact store the information it could simply adjust the picture to always fit, which would be a pretty cool feature actually.
All dimensions are stored within the sprite data. Sprite data is stored within $gameScreen.picture(pictureId). So you can for example find $gameScreen.picture(1)._width or $gameScreen.picture(1).width, not sure which is correct. If there is a picture of that ID, it should return the width of the sprite.
However, this returns the width of the sprite modified by scale, so if for example you scale the picture to be half its original size, the width will be half. If you want the original size when a picture is scaled, you need to go ask for the width of the texture!
$gameScreen.picture(1)._texture._width
My bad. Picture sprites are located in
SceneManager._scene._spriteset._pictureContainer.children.
And start from 0, not from 1.
So it's
SceneManager._scene._spriteset._pictureContainer.children[pictureId - 1].width
I'm 100% certain on that 😀