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.

TCollider.js 451B

123456789101112131415161718192021222324252627
  1. import {Trait} from "../Entity.js";
  2. export default class Collider extends Trait {
  3. constructor(entity) {
  4. super(entity, "collider");
  5. this.collides = false;
  6. this.cEntity = null;
  7. this.cStructure = null;
  8. }
  9. collideEntity(e) {
  10. this.cEntity = e;
  11. this.collides = true;
  12. }
  13. collideStructure(s) {
  14. this.cStructure = s;
  15. this.collides = true;
  16. }
  17. postUpdate() {
  18. this.cEntity = null;
  19. this.cStructure = null;
  20. this.collides = false;
  21. }
  22. }