excalibur
Version:
Excalibur.js is a simple JavaScript game engine with TypeScript bindings for making 2D games in HTML5 Canvas. Our mission is to make web game development as simple as possible.
26 lines (25 loc) • 994 B
TypeScript
import { Observable } from '../Util/Observable';
import { Entity } from './Entity';
export declare class TagQuery<TKnownTags extends string = never> {
readonly requiredTags: TKnownTags[];
readonly id: string;
tags: Set<TKnownTags>;
entities: Entity<any>[];
/**
* This fires right after the component is added
*/
entityAdded$: Observable<Entity<any>>;
/**
* This fires right before the component is actually removed from the entity, it will still be available for cleanup purposes
*/
entityRemoved$: Observable<Entity<any>>;
constructor(requiredTags: TKnownTags[]);
static createId(requiredComponents: string[]): string;
checkAndAdd(entity: Entity): boolean;
removeEntity(entity: Entity): void;
/**
* Returns a list of entities that match the query
* @param sort Optional sorting function to sort entities returned from the query
*/
getEntities(sort?: (a: Entity, b: Entity) => number): Entity<any>[];
}