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

123456789101112131415161718192021222324252627282930
  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. this.cBounds = null;
  9. }
  10. collideEntity(e) {
  11. this.collides = true;
  12. this.cEntity = e;
  13. this.cBounds = e.bounds;
  14. }
  15. collideStructure(s, b) {
  16. this.collides = true;
  17. this.cStructure = s;
  18. this.cBounds = b;
  19. }
  20. postUpdate() {
  21. this.cEntity = null;
  22. this.cStructure = null;
  23. this.collides = false;
  24. }
  25. }