Created
November 16, 2019 13:54
-
-
Save garganurag893/4a6cfb1b885b803a312ee0ffff24c16a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Matter from 'matter-js'; | |
const UpdatePlane = (entities, {touches, time}) => { | |
const engine = entities.physics.engine; | |
touches | |
.filter(t => t.type === 'press') | |
.forEach(t => { | |
Matter.Body.setVelocity(entities.Plane.body, { | |
x: entities.Plane.body.velocity.x, | |
y: -3, | |
}); | |
}); | |
Matter.Engine.update(engine, time.delta); | |
return entities; | |
}; | |
export default UpdatePlane; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment