Jump to content

Why can't have a circle has a child of a container?


cool-RR
 Share

Recommended Posts

Hi everyone!  Question from a Pixi.js newbie.

I want to have a player that's running around the screen, and composed of a few graphics primitives, like a circle and text. I successfully created a Container and a Text, and added the Text as a child.

But when I try to add Circle as a child, I get an error:

error TypeError: Cannot set property '_parentID' of undefined
    at e.addChild (Container.ts:145)
    at s (brython.min.js:1)
    at build_player_avatar40 (eval at e.loop (brython.min.js:1), <anonymous>:4330:71)
    at pixi_setup39 (eval at e.loop (brython.min.js:1), <anonymous>:4241:113)
    at brython.min.js:1
    at t.value (mini-signals.js:93)
    at e._onComplete (Loader.js:623)
    at Loader.js:662
    at s (async.js:33)
    at e.t.use (SpritesheetLoader.ts:37)

Does anyone have a clue what's wrong?

 

Thanks,

Ram.

 
Link to comment
Share on other sites

17 hours ago, cool-RR said:

Ah, I understand. How do I add a circle to a Graphics object? I looked at the docs and tutorial and couldn't find it. 

am not sure understand, but if you mean this, is very basic.
Here a demo for you.
https://www.pixiplayground.com/#/edit/SWEUf-xJbquqr-AsCMCrj
hope is help.

Note: doc is cool, but you also have a lot of basics demo here.
https://pixijs.io/examples/#/graphics/simple.js

if you a noob, pixiplayground is also great and fast way to practice and learn some basic behaviors. (types is include)

You can also pass the console context to Result frame and play with PIXIjs in console.j6hoGEmE_o.png

you also have a nice devtool plugin inspector to help debug or understand what append when you start. it should help your a lot.
https://chrome.google.com/webstore/detail/pixijs-devtools/aamddddknhcagpehecnhphigffljadon

 

Edited by jonforum
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...