Collider::isColliding
This commit is contained in:
parent
7b7b688d81
commit
6ea200f708
|
@ -4,6 +4,7 @@ import {StateProperty, Trait} from '@avocado/entity';
|
|||
|
||||
const decorate = compose(
|
||||
StateProperty('isCheckingCollisions'),
|
||||
StateProperty('isColliding'),
|
||||
);
|
||||
|
||||
export class Collider extends decorate(Trait) {
|
||||
|
@ -23,6 +24,7 @@ export class Collider extends decorate(Trait) {
|
|||
static defaultState() {
|
||||
return {
|
||||
isCheckingCollisions: true,
|
||||
isColliding: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,6 +112,9 @@ export class Collider extends decorate(Trait) {
|
|||
return {
|
||||
|
||||
collidesWith: (entity) => {
|
||||
if (!this.entity.isColliding || !entity.isColliding) {
|
||||
return false;
|
||||
}
|
||||
if (-1 !== this._doesNotCollideWith.indexOf(entity)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user