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.

Player.js 483B

1234567891011121314151617181920
  1. import Entity from "../Entity.js";
  2. import TKeyboardController from "../traits/TKeyboardController.js";
  3. import TPhysics from "../traits/TPhysics.js";
  4. import TCollider from "../traits/TCollider.js";
  5. export default class Player extends Entity {
  6. constructor(level) {
  7. super(level);
  8. this.bounds.size.set(1, 2);
  9. this.addTrait(new TCollider(this));
  10. this.addTrait(new TKeyboardController(this));
  11. this.addTrait(new TPhysics(this));
  12. }
  13. draw(ctx) {
  14. this.bounds.draw(ctx);
  15. }
  16. }