0
\$\begingroup\$

I'm trying to set a drag event on a Phaser 3 group, but I wasn't able to achieve what I want. I was reading some Phaser 2 blogs, and they said that it isn't possible to set a drag event on a group.

How can I go about creating similar behaviour?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

First let me explain the group behaviour here: the group game object does not have any shape or body, as it is basically an Array of game objects Array<gameObject>. So, it doesn't have any input events assigned.

As a group stores all its child data in a property called children, I suggest that you iterate through the children and add your mouse event to the game objects individually.

Otherwise, you can add all your gameObjects to the container and add your mouse event to the container, which would also give you the expected result.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .