Physics engine that I made with the stuff we learned in school
npm install physics-enginehtml
`
Example
Add a canvas to your body, so you can use it for rendering
`html
`
Initializing physics engine
`html
`
Getting canvas
`js
const canvas = document.querySelector("canvas");
`
Creating a physics world
Note: If you don't want the renderer you don't have to enter the canvas element
`js
const world = new Phygic.World(canvas);
`
Rendering
✨ Just run this function and done! ✨
`js
world.createAnimators();
`
Adding camera movement, tile dragging etc.
✨ Again, just one line! ✨
`js
world.addHelpers();
`
Adding a box
✨ Still one line! ✨
`js
new Phygic.Tile(50, 0, world);
`
Adding a static tile so our box doesn't fall to the nothingness
✨ You get the idea everything is one line. ✨
`js
new Phygic.Tile(50, 500, {world, isStatic: true});
`
Final product:
Preview
`html
``