cool-RR Posted October 1, 2020 Share Posted October 1, 2020 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. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 2, 2020 Share Posted October 2, 2020 circle is Shape, not a displayobject. you have to use it through Graphics, and then add Graphics wherever you need Quote Link to comment Share on other sites More sharing options...
cool-RR Posted October 2, 2020 Author Share Posted October 2, 2020 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. Quote Link to comment Share on other sites More sharing options...
jonforum Posted October 3, 2020 Share Posted October 3, 2020 (edited) 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. 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 October 3, 2020 by jonforum Quote Link to comment Share on other sites More sharing options...
cool-RR Posted October 3, 2020 Author Share Posted October 3, 2020 Thanks for your help Ivan and Jon. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.