angry-pixel 1.1.13 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/lib/component/Animator.d.ts +33 -33
  2. package/lib/component/AudioPlayer.d.ts +59 -59
  3. package/lib/component/Button.d.ts +42 -42
  4. package/lib/component/Camera.d.ts +20 -21
  5. package/lib/component/RigidBody.d.ts +22 -23
  6. package/lib/component/Sprite.d.ts +22 -22
  7. package/lib/component/Transform.d.ts +30 -30
  8. package/lib/component/collider/BallCollider.d.ts +25 -25
  9. package/lib/component/collider/BoxCollider.d.ts +33 -33
  10. package/lib/component/collider/Collider.d.ts +34 -35
  11. package/lib/component/collider/EdgeCollider.d.ts +29 -29
  12. package/lib/component/collider/PolygonCollider.d.ts +39 -40
  13. package/lib/component/collider/TilemapCollider.d.ts +29 -29
  14. package/lib/component/rendering/MaskRenderer.d.ts +27 -28
  15. package/lib/component/rendering/SpriteRenderer.d.ts +43 -44
  16. package/lib/component/rendering/TextRenderer.d.ts +46 -47
  17. package/lib/component/rendering/TiledTilemapRenderer.d.ts +78 -79
  18. package/lib/component/rendering/TilemapRenderer.d.ts +54 -55
  19. package/lib/core/Component.d.ts +86 -86
  20. package/lib/core/Game.d.ts +44 -44
  21. package/lib/core/GameActor.d.ts +115 -99
  22. package/lib/core/GameConfig.d.ts +18 -18
  23. package/lib/core/GameObject.d.ts +133 -133
  24. package/lib/core/Scene.d.ts +13 -13
  25. package/lib/core/facades/AssetManagerFacade.d.ts +41 -41
  26. package/lib/core/facades/DomManagerFacade.d.ts +8 -8
  27. package/lib/core/facades/GameObjectManagerFacade.d.ts +70 -70
  28. package/lib/core/facades/InputManagerFacade.d.ts +13 -13
  29. package/lib/core/facades/SceneManagerFacade.d.ts +18 -18
  30. package/lib/core/facades/TimeManagerFacade.d.ts +11 -11
  31. package/lib/core/ioc/Config.d.ts +3 -3
  32. package/lib/core/managers/AssetManager.d.ts +28 -28
  33. package/lib/core/managers/DomManager.d.ts +12 -9
  34. package/lib/core/managers/GameObjectManager.d.ts +36 -21
  35. package/lib/core/managers/HeadlessIterationManager.d.ts +29 -29
  36. package/lib/core/managers/IterationManager.d.ts +56 -56
  37. package/lib/core/managers/SceneManager.d.ts +31 -22
  38. package/lib/core/managers/TimeManager.d.ts +38 -24
  39. package/lib/gameObject/GameCamera.d.ts +16 -16
  40. package/lib/gameObject/SpacePointer.d.ts +8 -8
  41. package/lib/index.cjs.js +1 -1
  42. package/lib/index.d.ts +40 -38
  43. package/lib/index.esm.js +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/input/GamepadController.d.ts +51 -63
  46. package/lib/input/InputManager.d.ts +19 -12
  47. package/lib/input/KeyboardController.d.ts +12 -12
  48. package/lib/input/MouseController.d.ts +21 -21
  49. package/lib/input/TouchController.d.ts +13 -13
  50. package/lib/utils/Container.d.ts +12 -12
  51. package/lib/utils/Exception.d.ts +4 -4
  52. package/lib/utils/UUID.d.ts +1 -1
  53. package/package.json +4 -4
@@ -1,55 +1,54 @@
1
- import { TilemapOrientation } from "angry-pixel-2d-renderer";
2
- import { Vector2 } from "angry-pixel-math";
3
- import { RenderComponent } from "../../core/Component";
4
- export { TilemapOrientation };
5
- export interface Tileset {
6
- image: HTMLImageElement;
7
- width: number;
8
- tileWidth: number;
9
- tileHeight: number;
10
- margin?: Vector2;
11
- spacing?: Vector2;
12
- }
13
- export interface TilemapRendererOptions {
14
- tiles: string;
15
- tileset: Tileset;
16
- width: number;
17
- tileWidth: number;
18
- tileHeight: number;
19
- layer?: string;
20
- orientation?: TilemapOrientation;
21
- alpha?: number;
22
- tintColor?: string;
23
- smooth?: boolean;
24
- }
25
- export interface ITilemapRenderer {
26
- tiles: number[];
27
- width: number;
28
- height: number;
29
- tileWidth: number;
30
- tileHeight: number;
31
- orientation: TilemapOrientation;
32
- realWidth: number;
33
- realHeight: number;
34
- }
35
- export declare class TilemapRenderer extends RenderComponent implements ITilemapRenderer {
36
- private renderManager;
37
- tiles: number[];
38
- width: number;
39
- height: number;
40
- tileWidth: number;
41
- tileHeight: number;
42
- tintColor: string;
43
- alpha: number;
44
- orientation: TilemapOrientation;
45
- private tileset;
46
- private renderData;
47
- private layer;
48
- private scaledTileWidth;
49
- private scaledTileHeight;
50
- realWidth: number;
51
- realHeight: number;
52
- protected init({ tiles, tileset, tileWidth, tileHeight, width, layer, orientation, alpha, tintColor, smooth, }: TilemapRendererOptions): void;
53
- protected update(): void;
54
- private updateRenderData;
55
- }
1
+ import { TilemapOrientation } from "angry-pixel-2d-renderer";
2
+ import { Vector2 } from "angry-pixel-math";
3
+ import { RenderComponent } from "../../core/Component";
4
+ export { TilemapOrientation };
5
+ export interface Tileset {
6
+ image: HTMLImageElement;
7
+ width: number;
8
+ tileWidth: number;
9
+ tileHeight: number;
10
+ margin?: Vector2;
11
+ spacing?: Vector2;
12
+ }
13
+ export interface TilemapRendererOptions {
14
+ tiles: string;
15
+ tileset: Tileset;
16
+ width: number;
17
+ tileWidth: number;
18
+ tileHeight: number;
19
+ layer?: string;
20
+ orientation?: TilemapOrientation;
21
+ alpha?: number;
22
+ tintColor?: string;
23
+ smooth?: boolean;
24
+ }
25
+ export interface ITilemapRenderer {
26
+ tiles: number[];
27
+ width: number;
28
+ height: number;
29
+ tileWidth: number;
30
+ tileHeight: number;
31
+ orientation: TilemapOrientation;
32
+ realWidth: number;
33
+ realHeight: number;
34
+ }
35
+ export declare class TilemapRenderer extends RenderComponent implements ITilemapRenderer {
36
+ tiles: number[];
37
+ width: number;
38
+ height: number;
39
+ tileWidth: number;
40
+ tileHeight: number;
41
+ tintColor: string;
42
+ alpha: number;
43
+ orientation: TilemapOrientation;
44
+ private tileset;
45
+ private renderData;
46
+ private layer;
47
+ private scaledTileWidth;
48
+ private scaledTileHeight;
49
+ realWidth: number;
50
+ realHeight: number;
51
+ protected init({ tiles, tileset, tileWidth, tileHeight, width, layer, orientation, alpha, tintColor, smooth, }: TilemapRendererOptions): void;
52
+ protected update(): void;
53
+ private updateRenderData;
54
+ }
@@ -1,86 +1,86 @@
1
- import { GameObject } from "./GameObject";
2
- import { Scene } from "./Scene";
3
- import { FrameEvent } from "./managers/IterationManager";
4
- import { GameActor } from "./GameActor";
5
- import { Container } from "../utils/Container";
6
- export type ComponentClass<T extends Component = Component> = new (container: Container, gameObject: GameObject, name?: string) => T;
7
- export declare abstract class Component extends GameActor {
8
- readonly id: string;
9
- readonly name: string;
10
- readonly gameObject: GameObject;
11
- readonly allowMultiple: boolean;
12
- private _active;
13
- constructor(container: Container, gameObject: GameObject, name?: string);
14
- get active(): boolean;
15
- set active(active: boolean);
16
- /**
17
- * This method is called when the active state changes.
18
- */
19
- protected onActiveChange(): void;
20
- /**
21
- * @returns The current loaded scene
22
- */
23
- protected getCurrentScene<T extends Scene>(): T;
24
- /**
25
- * @returns The GameObject to which this component is attached
26
- */
27
- protected getGameObject<T extends GameObject>(): T;
28
- /**
29
- * Returns all the components in the game object.
30
- * @returns The found components
31
- */
32
- getComponents(): Component[];
33
- /**
34
- * Returns all the components for the given class in the game object.
35
- * @param componentClass The class of the components
36
- * @returns The found components
37
- */
38
- getComponents<T extends Component>(componentClass: ComponentClass<T>): T[];
39
- /**
40
- * Returns the first component found for the given class, or undefined otherwise.
41
- * @param componentClass The class of the component
42
- * @returns The found component
43
- */
44
- getComponent<T extends Component>(componentClass: ComponentClass<T>): T;
45
- /**
46
- * Returns the first component found for the given name, or undefined otherwise.
47
- * @param name The name of the component
48
- * @returns The found component
49
- */
50
- getComponent<T extends Component>(name: string): T;
51
- /**
52
- * Returns TRUE if the game object has a component for the given class, or FALSE otherwise
53
- * @param componentClass The class of the component to find
54
- * @returns boolean
55
- */
56
- hasComponent<T extends Component>(componentClass: ComponentClass<T>): boolean;
57
- /**
58
- * @param name The name of the component to find
59
- * @returns boolean
60
- */
61
- hasComponent(name: string): boolean;
62
- removeComponent(component: Component): void;
63
- protected _destroy(): void;
64
- protected _stopGame(): void;
65
- }
66
- export declare abstract class EngineComponent extends Component {
67
- protected readonly updateEvent: FrameEvent;
68
- }
69
- export declare abstract class ColliderComponent extends Component {
70
- protected readonly updateEvent: FrameEvent;
71
- }
72
- export declare abstract class PhysicsComponent extends Component {
73
- protected readonly updateEvent: FrameEvent;
74
- }
75
- export declare abstract class TransformComponent extends Component {
76
- protected readonly updateEvent: FrameEvent;
77
- }
78
- export declare abstract class PreRenderComponent extends Component {
79
- protected readonly updateEvent: FrameEvent;
80
- }
81
- export declare abstract class CameraComponent extends Component {
82
- protected readonly updateEvent: FrameEvent;
83
- }
84
- export declare abstract class RenderComponent extends Component {
85
- protected readonly updateEvent: FrameEvent;
86
- }
1
+ import { GameObject } from "./GameObject";
2
+ import { Scene } from "./Scene";
3
+ import { FrameEvent } from "./managers/IterationManager";
4
+ import { GameActor } from "./GameActor";
5
+ import { Container } from "../utils/Container";
6
+ export type ComponentClass<T extends Component = Component> = new (container: Container, gameObject: GameObject, name?: string) => T;
7
+ export declare abstract class Component extends GameActor {
8
+ readonly id: string;
9
+ readonly name: string;
10
+ readonly gameObject: GameObject;
11
+ readonly allowMultiple: boolean;
12
+ private _active;
13
+ constructor(container: Container, gameObject: GameObject, name?: string);
14
+ get active(): boolean;
15
+ set active(active: boolean);
16
+ /**
17
+ * This method is called when the active state changes.
18
+ */
19
+ protected onActiveChange(): void;
20
+ /**
21
+ * @returns The current loaded scene
22
+ */
23
+ protected getCurrentScene<T extends Scene>(): T;
24
+ /**
25
+ * @returns The GameObject to which this component is attached
26
+ */
27
+ protected getGameObject<T extends GameObject>(): T;
28
+ /**
29
+ * Returns all the components in the game object.
30
+ * @returns The found components
31
+ */
32
+ getComponents(): Component[];
33
+ /**
34
+ * Returns all the components for the given class in the game object.
35
+ * @param componentClass The class of the components
36
+ * @returns The found components
37
+ */
38
+ getComponents<T extends Component>(componentClass: ComponentClass<T>): T[];
39
+ /**
40
+ * Returns the first component found for the given class, or undefined otherwise.
41
+ * @param componentClass The class of the component
42
+ * @returns The found component
43
+ */
44
+ getComponent<T extends Component>(componentClass: ComponentClass<T>): T;
45
+ /**
46
+ * Returns the first component found for the given name, or undefined otherwise.
47
+ * @param name The name of the component
48
+ * @returns The found component
49
+ */
50
+ getComponent<T extends Component>(name: string): T;
51
+ /**
52
+ * Returns TRUE if the game object has a component for the given class, or FALSE otherwise
53
+ * @param componentClass The class of the component to find
54
+ * @returns boolean
55
+ */
56
+ hasComponent<T extends Component>(componentClass: ComponentClass<T>): boolean;
57
+ /**
58
+ * @param name The name of the component to find
59
+ * @returns boolean
60
+ */
61
+ hasComponent(name: string): boolean;
62
+ removeComponent(component: Component): void;
63
+ protected _destroy(): void;
64
+ protected _stopGame(): void;
65
+ }
66
+ export declare abstract class EngineComponent extends Component {
67
+ protected readonly updateEvent: FrameEvent;
68
+ }
69
+ export declare abstract class ColliderComponent extends Component {
70
+ protected readonly updateEvent: FrameEvent;
71
+ }
72
+ export declare abstract class PhysicsComponent extends Component {
73
+ protected readonly updateEvent: FrameEvent;
74
+ }
75
+ export declare abstract class TransformComponent extends Component {
76
+ protected readonly updateEvent: FrameEvent;
77
+ }
78
+ export declare abstract class PreRenderComponent extends Component {
79
+ protected readonly updateEvent: FrameEvent;
80
+ }
81
+ export declare abstract class CameraComponent extends Component {
82
+ protected readonly updateEvent: FrameEvent;
83
+ }
84
+ export declare abstract class RenderComponent extends Component {
85
+ protected readonly updateEvent: FrameEvent;
86
+ }
@@ -1,44 +1,44 @@
1
- import { InitOptions } from "./GameActor";
2
- import { GameConfig } from "./GameConfig";
3
- import { SceneClass } from "./Scene";
4
- export declare class Game {
5
- private readonly container;
6
- private sceneManager;
7
- private iterationManager;
8
- private _config;
9
- constructor(config: GameConfig);
10
- private setupManagers;
11
- /**
12
- * @returns GameConfig
13
- */
14
- get config(): GameConfig;
15
- /**
16
- * @returns running
17
- */
18
- get running(): boolean;
19
- /**
20
- * Add a scene to the game
21
- *
22
- * @param sceneClass the class of the scene
23
- * @param name The name of the scene
24
- * @param options [optional] This options will be passed to the init method
25
- * @param openingScene [default FALSE] If this is the opening scene, set TRUE, FALSE instead
26
- */
27
- addScene(sceneClass: SceneClass, name: string, options?: InitOptions, openingScene?: boolean): void;
28
- /**
29
- * Run the game
30
- */
31
- run(): void;
32
- /**
33
- * Stop the game
34
- */
35
- stop(): void;
36
- /**
37
- * Pauses the game
38
- */
39
- pause(): void;
40
- /**
41
- * Resumes the paused game
42
- */
43
- resume(): void;
44
- }
1
+ import { InitOptions } from "./GameActor";
2
+ import { GameConfig } from "./GameConfig";
3
+ import { SceneClass } from "./Scene";
4
+ export declare class Game {
5
+ private readonly container;
6
+ private sceneManager;
7
+ private iterationManager;
8
+ private _config;
9
+ constructor(config: GameConfig);
10
+ private setupManagers;
11
+ /**
12
+ * @returns GameConfig
13
+ */
14
+ get config(): GameConfig;
15
+ /**
16
+ * @returns running
17
+ */
18
+ get running(): boolean;
19
+ /**
20
+ * Add a scene to the game
21
+ *
22
+ * @param sceneClass the class of the scene
23
+ * @param name The name of the scene
24
+ * @param options [optional] This options will be passed to the init method
25
+ * @param openingScene [default FALSE] If this is the opening scene, set TRUE, FALSE instead
26
+ */
27
+ addScene(sceneClass: SceneClass, name: string, options?: InitOptions, openingScene?: boolean): void;
28
+ /**
29
+ * Run the game
30
+ */
31
+ run(): void;
32
+ /**
33
+ * Stop the game
34
+ */
35
+ stop(): void;
36
+ /**
37
+ * Pauses the game
38
+ */
39
+ pause(): void;
40
+ /**
41
+ * Resumes the paused game
42
+ */
43
+ resume(): void;
44
+ }
@@ -1,99 +1,115 @@
1
- import { Container } from "../utils/Container";
2
- import { GameObject, GameObjectClass } from "./GameObject";
3
- import { GameObjectManager } from "./managers/GameObjectManager";
4
- import { FrameEvent } from "./managers/IterationManager";
5
- export interface InitOptions {
6
- [key: string]: any;
7
- }
8
- export declare abstract class GameActor {
9
- protected readonly gameObjectManager: GameObjectManager;
10
- protected readonly updateEvent: FrameEvent;
11
- protected readonly container: Container;
12
- private started;
13
- constructor(container: Container);
14
- dispatch(event: FrameEvent, options?: InitOptions): void;
15
- /**
16
- * This method is called after instantiation (recommended for the creation of game objects).
17
- */
18
- protected init?(options?: InitOptions): void;
19
- /**
20
- * This method is called only once on the first available frame.
21
- */
22
- protected start?(): void;
23
- /**
24
- * This method is called on every frame.
25
- */
26
- protected update?(): void;
27
- /**
28
- * This method is called before destruction.
29
- */
30
- protected onDestroy?(): void;
31
- /**
32
- * Adds a new game object to the scene.
33
- * @param gameObjectClass The game object class
34
- * @returns The added game object
35
- * @returns
36
- */
37
- protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
38
- /**
39
- * Adds a new game object to the scene.
40
- * @param gameObjectClass The game object class
41
- * @param name The name of the game object
42
- * @returns The added game object
43
- * @returns
44
- */
45
- protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, name: string): T;
46
- /**
47
- * Adds a new game object to the scene.
48
- * @param gameObjectClass The game object class
49
- * @param options This options will be passed to the init method
50
- * @returns The added game object
51
- * @returns
52
- */
53
- protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options: InitOptions): T;
54
- /**
55
- * Adds a new game object to the scene.
56
- * @param gameObjectClass The game object class
57
- * @param options [optional] This options will be passed to the init method
58
- * @param name [optional] The name of the game object
59
- * @returns The added game object
60
- * @returns
61
- */
62
- protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions | string, name?: string): T;
63
- /**
64
- * Returns all the game objects in the scene.
65
- * @returns The found game objects
66
- */
67
- protected findGameObjects(): GameObject[];
68
- /**
69
- * Returns a collection of found game objects for the given class
70
- * @param gameObjectClass The game object class to find
71
- * @returns The found game objects
72
- */
73
- protected findGameObjects<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T[];
74
- /**
75
- * Returns the first game object found for the given class, or undefined otherwise.
76
- * @param gameObjectClass The game object class to find
77
- * @returns The found game object
78
- */
79
- protected findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
80
- /**
81
- * Returns the first game object found for the given name, or undefined otherwise.
82
- * @param name The name of the game object to find
83
- * @returns The found game object
84
- */
85
- protected findGameObject<T extends GameObject>(name: string): T;
86
- /**
87
- * Returns a collection of game objects found for the given tag
88
- * @param tag The tag of the game objects to find
89
- * @returns The found game objects
90
- */
91
- protected findGameObjectsByTag<T extends GameObject>(tag: string): T[];
92
- /**
93
- * Destroy the given game object
94
- * @param gameObject The game object to destory
95
- */
96
- protected destroyGameObject(gameObject: GameObject): void;
97
- protected abstract _destroy(): void;
98
- protected abstract _stopGame(): void;
99
- }
1
+ import { IPhysicsManager } from "angry-pixel-2d-physics";
2
+ import { IInputManager } from "../input/InputManager";
3
+ import { Container } from "../utils/Container";
4
+ import { GameConfig } from "./GameConfig";
5
+ import { GameObject, GameObjectClass } from "./GameObject";
6
+ import { IAssetManager } from "./managers/AssetManager";
7
+ import { IDomManager } from "./managers/DomManager";
8
+ import { IGameObjectManager } from "./managers/GameObjectManager";
9
+ import { FrameEvent } from "./managers/IterationManager";
10
+ import { ISceneManager } from "./managers/SceneManager";
11
+ import { ITimeManager } from "./managers/TimeManager";
12
+ import { IRenderManager } from "angry-pixel-2d-renderer";
13
+ export interface InitOptions {
14
+ [key: string]: any;
15
+ }
16
+ export declare abstract class GameActor {
17
+ protected readonly updateEvent: FrameEvent;
18
+ protected readonly container: Container;
19
+ protected readonly assetManager: IAssetManager;
20
+ protected readonly domManager: IDomManager;
21
+ protected readonly inputManager: IInputManager;
22
+ protected readonly gameObjectManager: IGameObjectManager;
23
+ protected readonly physicsManager: IPhysicsManager;
24
+ protected readonly renderManager: IRenderManager;
25
+ protected readonly sceneManager: ISceneManager;
26
+ protected readonly timeManager: ITimeManager;
27
+ protected readonly gameConfig: GameConfig;
28
+ private started;
29
+ constructor(container: Container);
30
+ dispatch(event: FrameEvent, options?: InitOptions): void;
31
+ /**
32
+ * This method is called after instantiation (recommended for the creation of game objects).
33
+ */
34
+ protected init?(options?: InitOptions): void;
35
+ /**
36
+ * This method is called only once on the first available frame.
37
+ */
38
+ protected start?(): void;
39
+ /**
40
+ * This method is called on every frame.
41
+ */
42
+ protected update?(): void;
43
+ /**
44
+ * This method is called before destruction.
45
+ */
46
+ protected onDestroy?(): void;
47
+ /**
48
+ * Adds a new game object to the scene.
49
+ * @param gameObjectClass The game object class
50
+ * @returns The added game object
51
+ * @returns
52
+ */
53
+ protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
54
+ /**
55
+ * Adds a new game object to the scene.
56
+ * @param gameObjectClass The game object class
57
+ * @param name The name of the game object
58
+ * @returns The added game object
59
+ * @returns
60
+ */
61
+ protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, name: string): T;
62
+ /**
63
+ * Adds a new game object to the scene.
64
+ * @param gameObjectClass The game object class
65
+ * @param options This options will be passed to the init method
66
+ * @returns The added game object
67
+ * @returns
68
+ */
69
+ protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options: InitOptions): T;
70
+ /**
71
+ * Adds a new game object to the scene.
72
+ * @param gameObjectClass The game object class
73
+ * @param options [optional] This options will be passed to the init method
74
+ * @param name [optional] The name of the game object
75
+ * @returns The added game object
76
+ * @returns
77
+ */
78
+ protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions | string, name?: string): T;
79
+ /**
80
+ * Returns all the game objects in the scene.
81
+ * @returns The found game objects
82
+ */
83
+ protected findGameObjects(): GameObject[];
84
+ /**
85
+ * Returns a collection of found game objects for the given class
86
+ * @param gameObjectClass The game object class to find
87
+ * @returns The found game objects
88
+ */
89
+ protected findGameObjects<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T[];
90
+ /**
91
+ * Returns the first game object found for the given class, or undefined otherwise.
92
+ * @param gameObjectClass The game object class to find
93
+ * @returns The found game object
94
+ */
95
+ protected findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
96
+ /**
97
+ * Returns the first game object found for the given name, or undefined otherwise.
98
+ * @param name The name of the game object to find
99
+ * @returns The found game object
100
+ */
101
+ protected findGameObject<T extends GameObject>(name: string): T;
102
+ /**
103
+ * Returns a collection of game objects found for the given tag
104
+ * @param tag The tag of the game objects to find
105
+ * @returns The found game objects
106
+ */
107
+ protected findGameObjectsByTag<T extends GameObject>(tag: string): T[];
108
+ /**
109
+ * Destroy the given game object
110
+ * @param gameObject The game object to destory
111
+ */
112
+ protected destroyGameObject(gameObject: GameObject): void;
113
+ protected abstract _destroy(): void;
114
+ protected abstract _stopGame(): void;
115
+ }
@@ -1,18 +1,18 @@
1
- import { BroadPhaseMethods, CollisionMatrix, CollisionMethods } from "angry-pixel-2d-physics";
2
- import { Rectangle, Vector2 } from "angry-pixel-math";
3
- export interface GameConfig {
4
- containerNode?: HTMLElement | null;
5
- gameWidth?: number;
6
- gameHeight?: number;
7
- debugEnabled?: boolean;
8
- canvasColor?: string;
9
- physicsFramerate?: number;
10
- spriteDefaultScale?: Vector2 | null;
11
- headless?: boolean;
12
- collisions?: {
13
- collisionMethod?: CollisionMethods;
14
- collisionArea?: Rectangle;
15
- collisionMatrix?: CollisionMatrix;
16
- collisionBroadPhaseMethod?: BroadPhaseMethods;
17
- };
18
- }
1
+ import { BroadPhaseMethods, CollisionMatrix, CollisionMethods } from "angry-pixel-2d-physics";
2
+ import { Rectangle, Vector2 } from "angry-pixel-math";
3
+ export interface GameConfig {
4
+ containerNode?: HTMLElement | null;
5
+ gameWidth?: number;
6
+ gameHeight?: number;
7
+ debugEnabled?: boolean;
8
+ canvasColor?: string;
9
+ physicsFramerate?: number;
10
+ spriteDefaultScale?: Vector2 | null;
11
+ headless?: boolean;
12
+ collisions?: {
13
+ collisionMethod?: CollisionMethods;
14
+ collisionArea?: Rectangle;
15
+ collisionMatrix?: CollisionMatrix;
16
+ collisionBroadPhaseMethod?: BroadPhaseMethods;
17
+ };
18
+ }