Last active
November 30, 2016 15:28
-
-
Save triacontane/1e2e914d5cbe5f54a2bf87f671dc7de8 to your computer and use it in GitHub Desktop.
指定した番号のピクチャの横幅と高さを取得します
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pictureId = 1, variableIdOfWidth = 1, variableIdOfHeight = 2; | |
var spritePicture = SceneManager._scene._spriteset._pictureContainer.children.filter(function(picture) { | |
return picture._pictureId === pictureId; | |
})[0]; | |
$gameVariables.setValue(variableIdOfWidth, spritePicture.width); | |
$gameVariables.setValue(variableIdOfHeight, spritePicture.height); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
指定した番号のピクチャの横幅と高さを取得して任意の変数に設定します。
ただし、ピクチャのロードが完了していないと幅と高さが0になってしまいます。