@maximeij/css-brickout
Version:
Classic Brickout Game Engine implemented in Typescript and rendered with CSS. No dependencies.
53 lines (52 loc) • 1.44 kB
TypeScript
import { Ball, Composite, MovingGameObjectConfig, MovingGameObject } from './';
export type BrickConfig = MovingGameObjectConfig & {
hp?: number;
breakthrough?: boolean;
ignoreMobile?: boolean;
};
export declare class Brick extends MovingGameObject {
breakthrough: boolean;
ignoreMobile: boolean;
destroyed: boolean;
hp: number;
maxHp: number;
containedBy?: string;
constructor({ hp, breakthrough, ignoreMobile, ...config }: BrickConfig);
takeHit(ball: Ball): void;
destroy(forReal?: boolean): void;
restore(): void;
}
export type CompositeBrickConfig = BrickConfig & {
hitboxParts?: Array<BrickConfig>;
};
export declare class CompositeBrick extends Brick implements Composite {
hitboxParts?: Array<Brick>;
constructor(config: CompositeBrickConfig);
get compositeBoundingBox(): {
topL: {
x: number;
y: number;
};
topR: {
x: number;
y: number;
};
bottomL: {
x: number;
y: number;
};
bottomR: {
x: number;
y: number;
};
};
updateElement(): void;
updateElementPosition(): void;
updateElementSize(): void;
updateTitle(): void;
takeHit(ball: Ball): void;
destroy(forReal?: boolean): void;
restore(): void;
toString(): string;
}
export type BrickDestroyedEvent = CustomEvent<Brick>;