Search the Community
Showing results for tags 'boundsSprite'.
-
Hey there. I'm stuck with the following problem: I have a game board and some tiles on it. I want to constrain the tiles' movement to a certain paths only. That path is in this case drawn by the red rectangles in the example (which are each a separate sprite), but the problem is that I can only assign one sprite to sprite.input.boundsSprite. I tried adding the other sprites to the first one as children (and adjusting their position accordingly), but that didn't change anything. If I draw all the rectangles to a single sprite, it won't work either as it will only get its outer bounds (and won't take into account the "holes" in this cage). Here's the example. There's only one tile for the sake of the example and it is constrained only to the first rectangle. Any help is greatly appreciated. I might also consider another approach that I may be able to implement. I've also tried other stuff like not using Phaser's InputHandler and implementing drag input myself, but that didn't work reliably. I feel that this example is the closest thing to what I expect to happen, I think that I'm just missing something very obvious. Thanks.