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 418B

12345678910111213141516171819
  1. import Entity from '../Entity.js';
  2. import Vec2 from '../Vec2.js';
  3. import KeyboardControls from '../traits/KeyboardControls.js';
  4. import Physics from '../traits/Physics.js';
  5. export default class Player extends Entity {
  6. constructor(level) {
  7. super(level);
  8. this.bounds.size.set(20, 20);
  9. this.addTrait(new KeyboardControls(this));
  10. this.addTrait(new Physics(this));
  11. }
  12. draw(ctx) {
  13. this.bounds.draw(ctx);
  14. }
  15. }