import { EightBittr } from "../EightBittr"; import { Actor } from "../types"; import { Section } from "./Section"; /** * Physics functions to move Actors around. */ export declare class Physics extends Section { /** * @returns The horizontal midpoint of the Actor. */ getMidX(actor: Actor): number; /** * @returns The vertical midpoint of the Actor. */ getMidY(actor: Actor): number; /** * Increases An Actor's width by pushing forward its right and decreasing its * width. It is marked as changed in appearance. * * @param actor * @param dx How much to increase the Actor's width. */ increaseWidth(actor: Actor, dx: number): void; /** * Reduces An Actor's height by pushing down its top and decreasing its * height. It is marked as changed in appearance. * * @param actor * @param dy How much to increase the Actor's height. * @param updateSize Whether to also call updateSize on the Actor (by default, false). */ increaseHeight(actor: Actor, dy: number): void; /** * Marks An Actor as having changed this upkeep. */ markChanged(actor: Actor): void; /** * Sets An Actor's bottom. * * @param bottom A new bottom border for the Actor. */ setBottom(actor: Actor, bottom: number): void; /** * Sets the height of an Actor, and optionally updates the * Actor's spriteHeight and spriteHeight pixels, and/or calls updateSize. * * @param actor * @param height A new height for the Actor. * @param updateSprite Whether to update the Actor's canvas (by default, false). * @param updateSize Whether to call updateSize on the Actor (by default, false). */ setHeight(actor: Actor, height: number, updateSprite?: boolean): void; /** * Sets An Actor's left. * * @param actor * @param left A new left border for the Actor. */ setLeft(actor: Actor, left: number): void; /** * Shifts An Actor so that it is centered on the given x and y. * * @param actor The Actor to shift vertically and horizontally. * @param x Where the Actor's horizontal midpoint should be. * @param y Where the Actor's vertical midpoint should be. */ setMid(actor: Actor, x: number, y: number): void; /** * Shifts An Actor so that its midpoint is centered on the midpoint of the * other Actor. * * @param actor The Actor to be shifted. * @param other The Actor whose midpoint is referenced. */ setMidObj(actor: Actor, other: Actor): void; /** * Shifts An Actor so that it is horizontally centered on the given x. * * @param actor The Actor to shift horizontally. * @param x Where the Actor's horizontal midpoint should be. */ setMidX(actor: Actor, x: number): void; /** * Shifts An Actor so that its horizontal midpoint is centered on the * midpoint of the other Actor. * * @param actor The Actor to be shifted horizontally. * @param other The Actor whose horizontal midpoint is referenced. */ setMidXObj(actor: Actor, other: Actor): void; /** * Shifts An Actor so that it is vertically centered on the given y. * * @param actor The Actor to shift vertically. * @param y Where the Actor's vertical midpoint should be. */ setMidY(actor: Actor, y: number): void; /** * Shifts An Actor so that its vertical midpoint is centered on the * midpoint of the other Actor. * * @param actor The Actor to be shifted vertically. * @param other The Actor whose vertical midpoint is referenced. */ setMidYObj(actor: Actor, other: Actor): void; /** * Sets An Actor's right. * * @param right A new right border for the Actor. */ setRight(actor: Actor, right: number): void; /** * Sets An Actor's top. * * @param top A new top border for the Actor. */ setTop(actor: Actor, top: number): void; /** * Sets the width of an Actor, and optionally updates the * Actor's spriteWidth and spriteWidth pixels, and/or calls updateSize. * The actor is marked as having changed appearance. * * @param actor * @param width A new width for the Actor. * @param updateSprite Whether to update the Actor's canvas (by default, false). * @param updateSize Whether to call updateSize on the Actor (by * default, false). */ setWidth(actor: Actor, width: number, updateSprite?: boolean): void; /** * Shifts an Actor both horizontally and vertically. * * @param dx How far to shift the Actor horizontally. * @param dy How far to shift the Actor vertically. */ shiftBoth(actor: Actor, dx?: number, dy?: number): void; /** * Shifts An Actor horizontally. * * @param dx How far to shift the Actor horizontally. */ shiftHorizontal(actor: Actor, dx: number): void; /** * Calls shiftBoth on all members of an Array. * * @param dx How far to shift the Actors horizontally. * @param dy How far to shift the Actors vertically. */ shiftActors(actors: Actor[], dx: number, dy: number): void; /** * Shifts An Actor vertically. * * @param dy How far to shift the Actor vertically. */ shiftVertical(actor: Actor, dy: number): void; /** * Calls shiftBoth on all groups of Actors. * * @param dx How far to shift the Actors horizontally. * @param dy How far to shift the Actors vertically. */ shiftAll(dx: number, dy: number): void; /** * Calls both setWidth and setHeight on An Actor. * * @param actor * @param width A new width for the Actor. * @param height A new height for the Actor. * @param updateSprite Whether to update the Actor's canvas (by default, false). */ setSize(actor: Actor, width: number, height: number, updateSprite?: boolean): void; /** * Shifts An Actor horizontally by its xVelocity and vertically by its yVelocity, using * shiftHorizontal and shiftVertical. * * @param actor */ updatePosition(actor: Actor): void; /** * Reduces An Actor's width by pushing back its right and decreasing its * width. It is marked as changed in appearance. * * @param actor * @param dx How much to reduce the Actor's width. */ reduceWidth(actor: Actor, dx: number): void; /** * Reduces An Actor's height by pushing down its top and decreasing its * height. It is marked as changed in appearance. * * @param actor * @param dy How much to reduce the Actor's height. */ reduceHeight(actor: Actor, dy: number): void; /** * Shifts An Actor toward a target x, but limits the total distance allowed. * Distance is computed as from the Actor's horizontal midpoint. * * @param actor The Actor to be shifted horizontally. * @param dx How far to shift the Actor horizontally. * @param maxDistance The maximum distance the Actor can be shifted (by * default, Infinity for no maximum). */ slideToX(actor: Actor, dx: number, maxDistance?: number): void; /** * Shifts An Actor toward a target y, but limits the total distance allowed. * Distance is computed as from the Actor's vertical midpoint. * * @param actor The Actor to be shifted vertically. * @param dy How far to shift the Actor vertically. * @param maxDistance The maximum distance the Actor can be shifted (by * default, Infinity, for no maximum). */ slideToY(actor: Actor, dy: number, maxDistance?: number): void; /** * @param actor * @param other * @returns Whether the first Actor's vertical midpoint is to the left * of the other's. */ actorAbove(actor: Actor, other: Actor): boolean; /** * @param actor * @param other * @returns Whether the first Actor's horizontal midpoint is to the left * of the other's. */ actorToLeft(actor: Actor, other: Actor): boolean; /** * Shifts An Actor's top up, then sets the bottom (similar to a shiftVertical and * a setTop combined). * * @param actor The Actor to be shifted vertically. * @param dy How far to shift the Actor vertically (by default, 0). */ updateTop(actor: Actor, dy?: number): void; /** * Shifts An Actor's right, then sets the left (similar to a shiftHorizontal and a * setRight combined). * * @param actor The Actor to be shifted horizontally. * @param dx How far to shift the Actor horizontally (by default, 0). */ updateRight(actor: Actor, dx?: number): void; /** * Shifts An Actor's bottom down, then sets the bottom (similar to a * shiftVertical and a setBottom combined). * * @param actor The Actor to be shifted vertically. * @param dy How far to shift the Actor vertically (by default, 0). */ updateBottom(actor: Actor, dy?: number): void; /** * Shifts An Actor's left, then sets the right (similar to a shiftHorizontal and a * setLeft combined). * * @param actor The Actor to be shifted horizontally. * @param dx How far to shift the Actor horizontally (by default, 0). */ updateLeft(actor: Actor, dx?: number): void; } //# sourceMappingURL=Physics.d.ts.map