arcade-physics
Version:
Use Arcade Physics without Phaser.
46 lines • 2.26 kB
TypeScript
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
import type { Body } from './Body';
import type { StaticBody } from './StaticBody';
import { ArcadePhysicsCallback, ArcadeProcessCallback } from './typedefs/types';
import type { World } from './World';
export declare class Collider {
world: World;
overlapOnly: boolean;
body1: Body | StaticBody | Array<Body | StaticBody>;
body2: Body | StaticBody | Array<Body | StaticBody>;
collideCallback: ArcadePhysicsCallback;
processCallback: ArcadeProcessCallback;
callbackContext: any;
/** The name of the collider (unused by Phaser). */
name: string;
/** Whether the collider is active. */
active: boolean;
/**
* An Arcade Physics Collider will automatically check for collision, or overlaps, between two objects
* every step. If a collision, or overlap, occurs it will invoke the given callbacks.
*
* @param world The world in which the bodies will collide.
* @param overlapOnly Whether to check for collisions or overlaps.
* @param body1 The first object to check for collision.
* @param body2 The second object to check for collision.
* @param collideCallback The callback to invoke when the two objects collide.
* @param processCallback If a processCallback exists it must return true or collision checking will be skipped.
* @param callbackContext The context the collideCallback and processCallback will run in.
*/
constructor(world: World, overlapOnly: boolean, body1: Body | StaticBody | Array<Body | StaticBody>, body2: Body | StaticBody | Array<Body | StaticBody>, collideCallback: ArcadePhysicsCallback, processCallback: ArcadeProcessCallback, callbackContext: any);
/**
* A name for the Collider.
*
* Phaser does not use this value, it's for your own reference.
*/
setName(name: string): this;
/** Called by World as part of its step processing, initial operation of collision checking. */
private update;
/** Removes Collider from World and disposes of its resources. */
destroy(): void;
}
//# sourceMappingURL=Collider.d.ts.map