Move inside a polygon

Hi !

I want my game object move only inside a polygon.
How can I do it ?

Here’s my codepen :
https://codepen.io/sparkkbolo/pen/pogOvLR

Thanks for your answer

I’d look into trying to use a polygon geom to check if the player x,y is within it and if it’s not then not allowing the player to move out of it

You have class Phaser.Geom.Polygon (contains method)

Thanks for your answers.
but I’ve made on a different way : I’ve created a gameobject with polygon in shape like this :
Screenshot 2020-09-10 at 11.48.14

and put it static.
It works :slight_smile: