UNPKG

arcade-physics

Version:
52 lines 2.68 kB
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ import { Body } from './Body'; import { StaticBody } from './StaticBody'; import { ArcadePhysicsCallback, ArcadeProcessCallback, CollisionCallback } from './typedefs/types'; import type { World } from './World'; export declare class Factory { world: World; scene: any; sys: any; /** * The Arcade Physics Factory allows you to easily create Arcade Physics enabled Game Objects. * Objects that are created by this Factory are automatically added to the physics world. * * @param world The Arcade Physics World instance. */ constructor(world: World); /** Creates a new Dynamic Arcade Body. */ body(x: number, y: number, width?: number, height?: number): Body; /** Creates a new Static Arcade Physics Body. */ staticBody(x: number, y: number, width?: number, height?: number): StaticBody; /** * Creates a new Arcade Physics Collider object. * * @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] - The callback to invoke when the two objects collide. Must return a boolean. * @param [callbackContext] - The scope in which to call the callbacks. * * @return The Collider that was created. */ collider(body1: Body | StaticBody | Array<Body | StaticBody>, body2: Body | StaticBody | Array<Body | StaticBody>, collideCallback?: CollisionCallback, processCallback?: CollisionCallback, callbackContext?: any): import("./Collider").Collider; /** * Creates a new Arcade Physics Collider Overlap object. * * @param body1 - The first object to check for overlap. * @param body2 - The second object to check for overlap. * @param [collideCallback] - The callback to invoke when the two objects collide. * @param [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. * @param [callbackContext] - The scope in which to call the callbacks. * * @return The Collider that was created. */ overlap(body1: Body | StaticBody | Array<Body | StaticBody>, body2: Body | StaticBody | Array<Body | StaticBody>, collideCallback?: ArcadePhysicsCallback, processCallback?: ArcadeProcessCallback, callbackContext?: any): import("./Collider").Collider; /** Destroys this Factory. */ destroy(): void; } //# sourceMappingURL=Factory.d.ts.map