I am trying to create a complex game object by extending the Container class, but I am having problems applying tweens and playing animations on the subobjects. I want to apply these to the individual subobjects because for example in certain conditions, I want an animation to play or make the object flash.
In the constructor of this object, I pass the scene object and some other attributes like texture name and position and add 3 game objects to container I extend. These 3 game objects are the main image, an animated sprite and a graphics object for a flash effect. I also add a tween to the scene object with the graphics object as target and I create an animation on the scene and play it on the sprite. However when I run the game, neither the tween nor the animation plays. I assume this is because the target I add is not in the scene container anymore, but rather in my custom container. So how can I achieve this?
I don’t think it should be necesarry, but I can try to provide some source code of what I have tried so far. In that case, what would be a good way to share this? I doesn’t seem like you can share code from Phaser Labs? Also I am quite new to making reusable game objects in Phaser, so I appreciate other advice on the topic as well.