The given display object is not adding as parent to group

#1

I have extended the phaser group class with respective super properties which includes parent display object. so I have given my phaser sprite as a parent to this group but when I check the “group.parent” it is showing the world as a parent, not the display object which I have passed through super class don’t know what is wrong with it?

#2

Hi,

I am not a pro of ES6, but using ES5 is more likely to be used to code a game in Phaser CE, it’s why the framework was redesigned to meet this objective of beeing more E6 friendly

If you can share a bit of code I wonder to pass the line to use ES6 with Phaser CE

#3

there it is, the first image is my group which is extending Phaser.Group.
and second where I am adding my group to the one of the parent display object(sprite) in the game.
but it is not adding as parent.

#4

It seems SketchMainJs extends Phaser.Game on the spot. I suggest to create custom game objects during and after boot state rather constructing with the game creation. It also seems that the this.loadingBarBackground not yet or no longer exists in the state which you gonna attach the LoadingBar to.

Update: I think the this.game.add.existing is problem that brings it to the world. I think if you construct the custom group object, you don’t have to call this.game.add.existing.

#5

working fine thank you mate, just needed to alter the child’s x and y as of parent display object but I did that in-game perspective.