I’m developing a game menù, when I create it I need to check if some items are unlocked, to do this I had to create a global array and to check it I had to appeal to JavaScript, but I’m stuck cause I can’t access to the points I had create in advance in the menù squares sprite. I’ve tried getPointX(name)
\ getPointY(name)
but I cannot access to a SpriteRuntimeObject instance, searching on the wiki I’ve seen only methods to access to RuntimeScene, RuntimeGame, RuntimeObject of my objects. I’ve also tried to create a new SpriteRuntimeObject trying to use his contructor, but I was stucked to insert dataObject.
Here how you can get a point called “center”
const allPlayerInstance = runtimeScene.getObjects("player");
const firstPlayerInstance = allPlayerInstance[0];
firstPlayerInstance.getPointPosition("center");
That’s what I’m trying to say. getPointPosition(), as also getPointX() and getPointY(), as documentation say, are methods of SpriteRuntimeObject, runtimeScene.getObjects() returns a list of istances of RuntimeObject. Also IDE didn’t found any methods with “point” keyword.
See line 2, allPlayerInstance
is an array of instances Player
and I pick the first instance in this array with 0.
So firstPlayerInstance is an SpriteRuntimeObject