We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I was trying to make my game fullscreen, so i changed the Renderer.options.width and height.
However, when i started my game, the ball struct whenever it tried to get out of the initial square.
I tried changing Body.bound on the ball, however, no luck.
Also is there a way to set global bounds so that i do not have to do it on every object?
Here is my code -
function Start(){ var Engine = Matter.Engine, World = Matter.World, Bodies = Matter.Bodies, Renderer = Matter.Renderer; Renderer = { options:{ wireframes: true, width: window.innerWidth, height: window.innerHeight }}; // create a Matter.js engine var engine = Engine.create(document.body,{render: Renderer}); engine.world.gravity.x = 0; engine.world.gravity.y = 0; // create two boxes and a ground var ball = Bodies.circle(400, 200, 20, { inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0, force: {x:0.03, y:0.03} }); var offset = 10; ball.bounds = { max: { x: Renderer.options.width, y: Renderer.options.height}, min: { x: offset, y: offset} } var ceiling = Bodies.rectangle(Renderer.options.width/2, -offset, Renderer.options.width + 2 * offset, 50.5, { isStatic: true }); var ground = Bodies.rectangle(Renderer.options.width/2, Renderer.options.height + offset, Renderer.options.width + 2 * offset, 50.5, { isStatic: true }); var rightSide = Bodies.rectangle(Renderer.options.width + offset, Renderer.options.height/2, 50.5, Renderer.options.height + 0.5 + 2 * offset, { isStatic: true }); var leftSide = Bodies.rectangle(-offset, Renderer.options.height/2, 50.5, Renderer.options.width + 0.5 + 2 * offset, { isStatic: true }); // add all of the bodies to the world World.add(engine.world, [ball, ceiling, ground, leftSide, rightSide]); // run the engine Engine.run(engine); }
The text was updated successfully, but these errors were encountered:
Please see #67, if you use the latest master build this should be resolved.
Sorry, something went wrong.
Thanks, that helped
No branches or pull requests
I was trying to make my game fullscreen, so i changed the Renderer.options.width and height.
However, when i started my game, the ball struct whenever it tried to get out of the initial square.
I tried changing Body.bound on the ball, however, no luck.
Also is there a way to set global bounds so that i do not have to do it on every object?
Here is my code -
The text was updated successfully, but these errors were encountered: