Jump to content

Managing children/parent on my own


Voobus
 Share

Recommended Posts

Hey guys, I'm trying to manage component children/parent references on my own, and I can't seem to get it to render with coordinates properly.

 

First off, I have a Scene that extends the container. The scene has a player property (the player's parent property is set to the scene).

 

In the scene's render method, I have it render the player, instead of looping through and rendering each child

class Scene extends Pixi.Container {    __player__ = new Pixi.Container();    renderWebGL (renderer) {        this.__player__.renderWebGL(renderer);    }}

As you can see, the player is another container, and I repeat the process, but I add a __sprite__ to the player.

 

What I get on the screen is that the player is rendering just fine to the scene, but when I adjust the x,y coordinates of the player container, it doesn't move. I've also tried setting the x,y of the sprite that lives inside of the player container.

 

tl;dr if I set the parent property of a component, is that good enough when trying to render something relative to a parent?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...