replit / kaboom

💥 JavaScript game library
https://kaboomjs.com
MIT License
2.61k stars 226 forks source link

docs(types.ts): add readd() examples #838

Closed SG-SWE073 closed 2 months ago

SG-SWE073 commented 3 months ago

Saw there was some confusion on how to use readd(), so I added some examples in jsDoc.

lajbel commented 3 months ago

I feel that the example is too long, could we reduce the components in the example objects? with sprite and pos should be enough

SG-SWE073 commented 3 months ago

So I updated and shortened some of the unneeded components. This brought up an interesting question to me " Why does it feel too long?", and I think that is because it is near the other examples that are short and don't need much explanation ( like move(), onClick(), fixed() etc.). There are some long examples already like state() and body(), that might need some explaining, and imo, the docs should be able to provide that to the users without worrying about the length of the doc or its neighboring examples.

I think the solution to this would be to only show the current example, or clicked on component from the sidebar, on its own page, so A) the explanation can be as long as needed. B) The user isn't seeing everything all at once ( doom scroll ).

Here are some examples of what I mean: Three.js creating text has it's own page: https://threejs.org/docs/index.html#manual/en/introduction/Creating-text Unity lighting is subdivided with their own pages: https://docs.unity3d.com/Manual/choose-a-lighting-setup.html

I know there are other issues that should be taken care of first, but maybe this can be considered for v4000-v5000.

SG-SWE073 commented 2 months ago

Does the code need to be adjusted any further, or is it good to go?

lajbel commented 2 months ago

Is looking good for me, only that little thing

SG-SWE073 commented 2 months ago

Indents should be removed now with recent commit

lajbel commented 2 months ago

Thank you for your contribution to documentation! 😇