Skip to content

How to use getCharactersAt #361

Answered by Annoraaq
sbernardotti asked this question in Q&A
Discussion options

You must be logged in to vote

I think in your case the problem is that you omit the charLayer argument of setPosition. Therefore it defaults to undefined. So you position the character to charLayer undefined.
Change it to
this.gridEngine.setPosition("player", { x: 50, y: 50 }, "charLayer");
and it should work.

Now that I see it, I must say that I can understand the confusion here. It is not very intuitive that the char layer is also changed if you do not pass it.

I think a reason for this was compatibility for tilemaps without char layers. If no char layers are specified in a tile map, the uppermost layer that does not have the ge_alwaysTop property is selected as the default char layer, called undefined.
And it is an…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sbernardotti
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants