Skip to content

Instantly share code, notes, and snippets.

@lonekorean
Created October 23, 2017 21:17
Show Gist options
  • Save lonekorean/9953131ac673c734963268aefdc9535e to your computer and use it in GitHub Desktop.
Save lonekorean/9953131ac673c734963268aefdc9535e to your computer and use it in GitHub Desktop.
Matter.js beforeUpdate event
Matter.Events.on(engine, 'beforeUpdate', function(event) {
if (pinball.position.x > 450 && pinball.velocity.y > 0) {
Matter.Body.setVelocity(pinball, { x: 0, y: -10 });
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment