You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Physics.js 227B

12345678910111213
  1. import {Trait} from '../Entity.js';
  2. export default class Physics extends Trait {
  3. constructor(entity) {
  4. super(entity, "physics");
  5. this.gravity = 9.81;
  6. }
  7. update(dt) {
  8. this.entity.velocity.y += this.gravity * dt;
  9. }
  10. }