Interactives overlap + Layers


#1

Hello,

I’m sorta new to Heaps.io, working on a 2d game utilizing mostly the h2d class.

I think I got the gist of how things work already, and parenting h2d objects to other h2d objects is kinda neat.

Currently I’m facing a situation:
I am making an options menu,

  • There will be a list of categories on the left side and when you click on a category in the list,
  • The right side will display the graphical side with options of that category along with interactives.

Now, I managed to get graphics part by using h2d.Layers and its method .over() to draw the wanted category on top of everything else.
But I can’t get the interactives to move with the method even though the interactives are made children of the graphics.

Is there a way to shift the interactives along with the graphics with Layers?
Or do I need to manually add and remove the interactives from the scene every time I change categories?

Thanks.


#2

It seems yes. I’ll make a PR that fixes this bug (over/under and ysort not reodering Interactive), but for now you can just reattach moved Interactive by using

scene.removeEventTarget(i);
scene.addEventTarget(i);

where scene is s2d and i is an instance of Interactive.