angry-pixel 2.3.3 → 2.3.5
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.
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +251 -51
- package/lib/index.esm.js +1 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -945,6 +945,20 @@ declare class EntityManager {
|
|
|
945
945
|
* ```
|
|
946
946
|
*/
|
|
947
947
|
createEntity(archetype: Archetype, parent?: Entity): Entity;
|
|
948
|
+
/**
|
|
949
|
+
* Adds the components of an Archetype to an existing Entity.\
|
|
950
|
+
* Component instances are cloned, so the archetype can be reused.\
|
|
951
|
+
* Child archetypes are created as new entities parented to the given one.
|
|
952
|
+
* @param entity The entity to add the archetype to
|
|
953
|
+
* @param archetype The archetype to add
|
|
954
|
+
* @public
|
|
955
|
+
* @example
|
|
956
|
+
* ```js
|
|
957
|
+
* const entity = entityManager.createEntity();
|
|
958
|
+
* entityManager.addArchetype(entity, archetype);
|
|
959
|
+
* ```
|
|
960
|
+
*/
|
|
961
|
+
addArchetype(entity: Entity, { components, disabledComponents, children, enabled }: Archetype): void;
|
|
948
962
|
private createEntityFromArray;
|
|
949
963
|
/**
|
|
950
964
|
* Creates an Entity from an Archetype.
|
|
@@ -1644,8 +1658,12 @@ interface GameConfig {
|
|
|
1644
1658
|
mousePosition: boolean;
|
|
1645
1659
|
/** Show text renderer bounding boxes */
|
|
1646
1660
|
textRendererBoundingBoxes: boolean;
|
|
1661
|
+
/** Show button shapes */
|
|
1662
|
+
buttons?: boolean;
|
|
1647
1663
|
/** Color of the colliders, default "#00FF00" (green) */
|
|
1648
1664
|
collidersColor?: string;
|
|
1665
|
+
/** Color of the button shapes, default "#FF00FF" (magenta) */
|
|
1666
|
+
buttonColor?: string;
|
|
1649
1667
|
/** Color of the text box, default "#0000FF" (blue) */
|
|
1650
1668
|
textBoxColor?: string;
|
|
1651
1669
|
/** Color of the text, default "#00FF00" (green) */
|
|
@@ -2619,17 +2637,25 @@ declare enum ButtonShape {
|
|
|
2619
2637
|
*
|
|
2620
2638
|
* const tiledWrapper = new TiledWrapper({
|
|
2621
2639
|
* tilemap: assetManager.getJson("tilemap.json"),
|
|
2622
|
-
* layerToRender: "Ground"
|
|
2640
|
+
* layerToRender: "Ground",
|
|
2641
|
+
* objects: new Map([
|
|
2642
|
+
* ["Player", playerArchetype],
|
|
2643
|
+
* ["Coin", [new Transform(), new SpriteRenderer({ image: "coin.png" })]],
|
|
2644
|
+
* ["Door", (properties) => doorArchetype(properties.get("locked"))]
|
|
2645
|
+
* ])
|
|
2623
2646
|
* });
|
|
2624
2647
|
* ```
|
|
2625
2648
|
*/
|
|
2626
2649
|
interface TiledWrapperOptions {
|
|
2627
2650
|
tilemap: TiledTilemap | string;
|
|
2628
2651
|
layerToRender: string;
|
|
2652
|
+
objects: Map<string, TiledObjectBlueprint>;
|
|
2629
2653
|
}
|
|
2630
2654
|
/**
|
|
2631
2655
|
* The TiledWrapper component wraps a Tiled map editor tilemap and handles rendering a specific layer.\
|
|
2632
|
-
* It provides an interface between Tiled's map format and the engine's tilemap rendering system
|
|
2656
|
+
* It provides an interface between Tiled's map format and the engine's tilemap rendering system.\
|
|
2657
|
+
* The tiles animated in Tiled are mapped to the animations of the TilemapRenderer tileset.\
|
|
2658
|
+
* It can also create entities from the objects of the tilemap, matching them by class with the `objects` map.
|
|
2633
2659
|
* @public
|
|
2634
2660
|
* @category Components
|
|
2635
2661
|
* @example
|
|
@@ -2654,10 +2680,62 @@ declare class TiledWrapper {
|
|
|
2654
2680
|
tilemap: TiledTilemap | string;
|
|
2655
2681
|
/** The layer to render. */
|
|
2656
2682
|
layerToRender: string;
|
|
2683
|
+
/**
|
|
2684
|
+
* Entities to create from the objects found in the tilemap, keyed by the object class.\
|
|
2685
|
+
* Objects are matched by class in every visible object layer of the tilemap.
|
|
2686
|
+
*/
|
|
2687
|
+
objects: Map<string, TiledObjectBlueprint>;
|
|
2688
|
+
/** @internal */
|
|
2689
|
+
_processed: boolean;
|
|
2690
|
+
/** @internal */
|
|
2691
|
+
_objectsCreated: boolean;
|
|
2692
|
+
/** @internal */
|
|
2693
|
+
_animationsMapped: boolean;
|
|
2694
|
+
/** The coordinates (in tiles) of the top-left corner of the rendered layer. @internal */
|
|
2695
|
+
_origin: Vector2;
|
|
2657
2696
|
/** @internal */
|
|
2658
2697
|
static componentName: string;
|
|
2659
2698
|
constructor(options?: Partial<TiledWrapperOptions>);
|
|
2699
|
+
/**
|
|
2700
|
+
* Reads the tilemap again, to apply the changes made to it at runtime, such as rendering another layer.\
|
|
2701
|
+
* The entities created from the objects of the tilemap are not created again.\
|
|
2702
|
+
* The TilemapRenderer and the TilemapCollider of the entity need to be refreshed too.\
|
|
2703
|
+
* This operation is expensive, avoid calling it on every frame.
|
|
2704
|
+
*/
|
|
2705
|
+
refresh(): void;
|
|
2660
2706
|
}
|
|
2707
|
+
/**
|
|
2708
|
+
* The properties of a Tiled object, keyed by property name.\
|
|
2709
|
+
* `int` and `float` properties are given as `number`, `bool` as `boolean`, `string`, `color` and `file` as `string`,\
|
|
2710
|
+
* and `class` as a nested set of values.\
|
|
2711
|
+
* Properties of type `object` are given as the {@link Entity} created for the referenced Tiled object,\
|
|
2712
|
+
* or `undefined` if no entity was created for it.
|
|
2713
|
+
* @public
|
|
2714
|
+
* @category Components Configuration
|
|
2715
|
+
*/
|
|
2716
|
+
type TiledObjectProperties = Map<string, number | boolean | string | Entity | Record<string, unknown>>;
|
|
2717
|
+
/**
|
|
2718
|
+
* Creates the entity for a Tiled object, based on its properties.
|
|
2719
|
+
* @param properties The properties of the Tiled object
|
|
2720
|
+
* @param object The Tiled object itself
|
|
2721
|
+
* @returns An archetype or a collection of components
|
|
2722
|
+
* @public
|
|
2723
|
+
* @category Components Configuration
|
|
2724
|
+
* @example
|
|
2725
|
+
* ```js
|
|
2726
|
+
* const doorFactory = (properties, object) => ({
|
|
2727
|
+
* components: [new Door({ locked: properties.get("locked"), lever: properties.get("lever") })]
|
|
2728
|
+
* });
|
|
2729
|
+
* ```
|
|
2730
|
+
*/
|
|
2731
|
+
type TiledObjectFactory = (properties: TiledObjectProperties, object: TiledObject) => Archetype | Component[];
|
|
2732
|
+
/**
|
|
2733
|
+
* Defines the entity to create for a Tiled object class. It can be an archetype, a collection of components,\
|
|
2734
|
+
* or a {@link TiledObjectFactory} function that builds either of them from the object's properties.
|
|
2735
|
+
* @public
|
|
2736
|
+
* @category Components Configuration
|
|
2737
|
+
*/
|
|
2738
|
+
type TiledObjectBlueprint = Archetype | Component[] | TiledObjectFactory;
|
|
2661
2739
|
/**
|
|
2662
2740
|
* @public
|
|
2663
2741
|
* @category Components Configuration
|
|
@@ -2666,15 +2744,55 @@ interface TiledTilemap {
|
|
|
2666
2744
|
width: number;
|
|
2667
2745
|
height: number;
|
|
2668
2746
|
infinite: boolean;
|
|
2669
|
-
layers: (TiledLayer | TiledObjectLayer)[];
|
|
2747
|
+
layers: (TiledLayer | TiledObjectLayer | TiledGroupLayer)[];
|
|
2670
2748
|
renderorder: string;
|
|
2671
|
-
tilesets:
|
|
2672
|
-
firstgid: number;
|
|
2673
|
-
}[];
|
|
2749
|
+
tilesets: TiledTileset[];
|
|
2674
2750
|
tilewidth: number;
|
|
2675
2751
|
tileheight: number;
|
|
2676
2752
|
properties?: TiledProperty[];
|
|
2677
2753
|
}
|
|
2754
|
+
/**
|
|
2755
|
+
* @public
|
|
2756
|
+
* @category Components Configuration
|
|
2757
|
+
*/
|
|
2758
|
+
interface TiledTileset {
|
|
2759
|
+
/** The id of the first tile of the tileset. The id of a tile is this value plus the id it has within the tileset */
|
|
2760
|
+
firstgid: number;
|
|
2761
|
+
/** Only present in external tilesets, which are not read by the engine */
|
|
2762
|
+
source?: string;
|
|
2763
|
+
name?: string;
|
|
2764
|
+
image?: string;
|
|
2765
|
+
columns?: number;
|
|
2766
|
+
tilecount?: number;
|
|
2767
|
+
tilewidth?: number;
|
|
2768
|
+
tileheight?: number;
|
|
2769
|
+
margin?: number;
|
|
2770
|
+
spacing?: number;
|
|
2771
|
+
/** Only the tiles with data of their own, such as animations or properties */
|
|
2772
|
+
tiles?: TiledTilesetTile[];
|
|
2773
|
+
}
|
|
2774
|
+
/**
|
|
2775
|
+
* @public
|
|
2776
|
+
* @category Components Configuration
|
|
2777
|
+
*/
|
|
2778
|
+
interface TiledTilesetTile {
|
|
2779
|
+
/** The id of the tile within the tileset */
|
|
2780
|
+
id: number;
|
|
2781
|
+
animation?: TiledTileAnimationFrame[];
|
|
2782
|
+
objectgroup?: TiledObjectLayer;
|
|
2783
|
+
properties?: TiledProperty[];
|
|
2784
|
+
type?: string;
|
|
2785
|
+
}
|
|
2786
|
+
/**
|
|
2787
|
+
* @public
|
|
2788
|
+
* @category Components Configuration
|
|
2789
|
+
*/
|
|
2790
|
+
interface TiledTileAnimationFrame {
|
|
2791
|
+
/** The duration of the frame in milliseconds */
|
|
2792
|
+
duration: number;
|
|
2793
|
+
/** The id of the tile to render, within the tileset */
|
|
2794
|
+
tileid: number;
|
|
2795
|
+
}
|
|
2678
2796
|
/**
|
|
2679
2797
|
* @public
|
|
2680
2798
|
* @category Components Configuration
|
|
@@ -2721,9 +2839,29 @@ interface TiledObjectLayer {
|
|
|
2721
2839
|
objects: TiledObject[];
|
|
2722
2840
|
opacity: number;
|
|
2723
2841
|
type: "objectgroup";
|
|
2724
|
-
visible:
|
|
2842
|
+
visible: boolean;
|
|
2843
|
+
x: number;
|
|
2844
|
+
y: number;
|
|
2845
|
+
offsetx?: number;
|
|
2846
|
+
offsety?: number;
|
|
2847
|
+
properties?: TiledProperty[];
|
|
2848
|
+
}
|
|
2849
|
+
/**
|
|
2850
|
+
* A layer that groups other layers. Its offset and its visibility are applied to all of them.
|
|
2851
|
+
* @public
|
|
2852
|
+
* @category Components Configuration
|
|
2853
|
+
*/
|
|
2854
|
+
interface TiledGroupLayer {
|
|
2855
|
+
id: number;
|
|
2856
|
+
name: string;
|
|
2857
|
+
type: "group";
|
|
2858
|
+
layers: (TiledLayer | TiledObjectLayer | TiledGroupLayer)[];
|
|
2859
|
+
opacity: number;
|
|
2860
|
+
visible: boolean;
|
|
2725
2861
|
x: number;
|
|
2726
2862
|
y: number;
|
|
2863
|
+
offsetx?: number;
|
|
2864
|
+
offsety?: number;
|
|
2727
2865
|
properties?: TiledProperty[];
|
|
2728
2866
|
}
|
|
2729
2867
|
/**
|
|
@@ -2731,13 +2869,17 @@ interface TiledObjectLayer {
|
|
|
2731
2869
|
* @category Components Configuration
|
|
2732
2870
|
*/
|
|
2733
2871
|
interface TiledObject {
|
|
2734
|
-
|
|
2872
|
+
/** Only present in tile objects. Their origin is the bottom-left corner, instead of the top-left corner */
|
|
2873
|
+
gid?: number;
|
|
2735
2874
|
height: number;
|
|
2736
2875
|
id: number;
|
|
2737
2876
|
name: string;
|
|
2738
2877
|
rotation: number;
|
|
2739
|
-
type
|
|
2740
|
-
|
|
2878
|
+
/** The class of the object. Tiled 1.9 exports it as `class`, the other versions as `type` */
|
|
2879
|
+
type?: string;
|
|
2880
|
+
/** The class of the object, as exported by Tiled 1.9 */
|
|
2881
|
+
class?: string;
|
|
2882
|
+
visible: boolean;
|
|
2741
2883
|
width: number;
|
|
2742
2884
|
x: number;
|
|
2743
2885
|
y: number;
|
|
@@ -2757,8 +2899,9 @@ interface TiledObject {
|
|
|
2757
2899
|
*/
|
|
2758
2900
|
interface TiledProperty {
|
|
2759
2901
|
name: string;
|
|
2760
|
-
type: "int" | "bool" | "float" | "color" | "string";
|
|
2761
|
-
|
|
2902
|
+
type: "int" | "bool" | "float" | "color" | "string" | "file" | "object" | "class";
|
|
2903
|
+
/** Properties of type `object` hold the id of another Tiled object, and `class` properties hold a nested set of values */
|
|
2904
|
+
value: number | string | boolean | Record<string, unknown>;
|
|
2762
2905
|
}
|
|
2763
2906
|
|
|
2764
2907
|
/**
|
|
@@ -3317,6 +3460,11 @@ declare class TilemapCollider implements Collider {
|
|
|
3317
3460
|
/** @internal */
|
|
3318
3461
|
static componentName: string;
|
|
3319
3462
|
constructor(options?: Partial<TilemapColliderOptions>);
|
|
3463
|
+
/**
|
|
3464
|
+
* Generates the collider shapes again, to apply the changes made to the tilemap at runtime.\
|
|
3465
|
+
* This operation is expensive, avoid calling it on every frame.
|
|
3466
|
+
*/
|
|
3467
|
+
refresh(): void;
|
|
3320
3468
|
}
|
|
3321
3469
|
|
|
3322
3470
|
declare enum RenderDataType {
|
|
@@ -3490,7 +3638,6 @@ interface TilemapRenderData extends RenderData {
|
|
|
3490
3638
|
tiles: number[];
|
|
3491
3639
|
tilemap: Tilemap;
|
|
3492
3640
|
tileset: Tileset$1;
|
|
3493
|
-
tileAnimations?: Map<number, number>;
|
|
3494
3641
|
smooth?: boolean;
|
|
3495
3642
|
flipHorizontal?: boolean;
|
|
3496
3643
|
flipVertical?: boolean;
|
|
@@ -3503,12 +3650,30 @@ interface TilemapRenderData extends RenderData {
|
|
|
3503
3650
|
}
|
|
3504
3651
|
type Tileset$1 = {
|
|
3505
3652
|
image: HTMLImageElement;
|
|
3506
|
-
width: number;
|
|
3507
3653
|
tileWidth: number;
|
|
3508
3654
|
tileHeight: number;
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3655
|
+
/** Space in pixels between the tiles and the four edges of the image */
|
|
3656
|
+
margin?: number;
|
|
3657
|
+
/** Space in pixels between adjacent tiles */
|
|
3658
|
+
spacing?: number;
|
|
3659
|
+
/** Maps each animated tile id to the tile id currently displayed. @internal */
|
|
3660
|
+
_animationState?: Map<number, number>;
|
|
3661
|
+
/** Tileset values in texture coordinates. Computed once by the renderer. @internal */
|
|
3662
|
+
_texData?: TilesetTexData;
|
|
3663
|
+
};
|
|
3664
|
+
/**
|
|
3665
|
+
* Tileset values expressed in texture coordinates (0 to 1), plus the number of columns of the tileset.
|
|
3666
|
+
* @internal
|
|
3667
|
+
*/
|
|
3668
|
+
type TilesetTexData = {
|
|
3669
|
+
/** The width of the tileset (in tiles) */
|
|
3670
|
+
columns: number;
|
|
3671
|
+
/** The margin of the image */
|
|
3672
|
+
margin: Vector2;
|
|
3673
|
+
/** The distance between the origin of two adjacent tiles */
|
|
3674
|
+
step: Vector2;
|
|
3675
|
+
/** The size of a tile */
|
|
3676
|
+
tileSize: Vector2;
|
|
3512
3677
|
};
|
|
3513
3678
|
type Tilemap = {
|
|
3514
3679
|
width: number;
|
|
@@ -4111,7 +4276,7 @@ declare const defaultTextureAtlasOptions: {
|
|
|
4111
4276
|
* opacity: 0.5,
|
|
4112
4277
|
* },
|
|
4113
4278
|
* textureAtlas: {
|
|
4114
|
-
* charRanges: [32,
|
|
4279
|
+
* charRanges: [32, 132, 161, 255, 0x3040, 0x309f],
|
|
4115
4280
|
* fontSize: 64,
|
|
4116
4281
|
* spacing: 4,
|
|
4117
4282
|
* },
|
|
@@ -4166,9 +4331,15 @@ interface TextRendererOptions {
|
|
|
4166
4331
|
text: string;
|
|
4167
4332
|
/** The texture atlas configuration */
|
|
4168
4333
|
textureAtlas: {
|
|
4169
|
-
/**
|
|
4170
|
-
*
|
|
4171
|
-
*
|
|
4334
|
+
/** Ranges of characters covered by the component, defined as pairs of
|
|
4335
|
+
* Unicode code points (each pair is an inclusive from–to range).
|
|
4336
|
+
* The default value is [32, 132, 161, 255], which covers Basic Latin
|
|
4337
|
+
* (letters, digits and punctuation) and the Latin-1 Supplement
|
|
4338
|
+
* (accented letters and symbols used by Western European languages).
|
|
4339
|
+
* Additional pairs can be appended to render other alphabets, e.g.
|
|
4340
|
+
* [0x3040, 0x309F] for Japanese Hiragana or [0x0400, 0x04FF] for Cyrillic.
|
|
4341
|
+
* See the official Unicode Character Code Charts to find the range of
|
|
4342
|
+
* each alphabet: {@link https://www.unicode.org/charts/} */
|
|
4172
4343
|
charRanges?: number[];
|
|
4173
4344
|
/** The size of the font in pixels for bitmap fonts. */
|
|
4174
4345
|
fontSize?: number;
|
|
@@ -4219,7 +4390,7 @@ interface TextRendererOptions {
|
|
|
4219
4390
|
* opacity: 0.5,
|
|
4220
4391
|
* },
|
|
4221
4392
|
* textureAtlas: {
|
|
4222
|
-
* charRanges: [32,
|
|
4393
|
+
* charRanges: [32, 132, 161, 255, 0x3040, 0x309f],
|
|
4223
4394
|
* fontSize: 64,
|
|
4224
4395
|
* spacing: 4,
|
|
4225
4396
|
* },
|
|
@@ -4276,9 +4447,15 @@ declare class TextRenderer {
|
|
|
4276
4447
|
text: string;
|
|
4277
4448
|
/** The texture atlas configuration */
|
|
4278
4449
|
textureAtlas: {
|
|
4279
|
-
/**
|
|
4280
|
-
*
|
|
4281
|
-
*
|
|
4450
|
+
/** Ranges of characters covered by the component, defined as pairs of
|
|
4451
|
+
* Unicode code points (each pair is an inclusive from–to range).
|
|
4452
|
+
* The default value is [32, 132, 161, 255], which covers Basic Latin
|
|
4453
|
+
* (letters, digits and punctuation) and the Latin-1 Supplement
|
|
4454
|
+
* (accented letters and symbols used by Western European languages).
|
|
4455
|
+
* Additional pairs can be appended to render other alphabets, e.g.
|
|
4456
|
+
* [0x3040, 0x309F] for Japanese Hiragana or [0x0400, 0x04FF] for Cyrillic.
|
|
4457
|
+
* See the official Unicode Character Code Charts to find the range of
|
|
4458
|
+
* each alphabet: {@link https://www.unicode.org/charts/} */
|
|
4282
4459
|
charRanges?: number[];
|
|
4283
4460
|
/** The size of the font in pixels for bitmap fonts. */
|
|
4284
4461
|
fontSize?: number;
|
|
@@ -4304,11 +4481,10 @@ declare class TextRenderer {
|
|
|
4304
4481
|
* layer: "Default",
|
|
4305
4482
|
* tileset: {
|
|
4306
4483
|
* image: this.assetManager.getImage("tileset.png"),
|
|
4307
|
-
* width: 10,
|
|
4308
4484
|
* tileWidth: 32,
|
|
4309
4485
|
* tileHeight: 32,
|
|
4310
|
-
* margin:
|
|
4311
|
-
* spacing:
|
|
4486
|
+
* margin: 0,
|
|
4487
|
+
* spacing: 0
|
|
4312
4488
|
* },
|
|
4313
4489
|
* data: [1, 2, 3, 4],
|
|
4314
4490
|
* chunks: [],
|
|
@@ -4338,7 +4514,7 @@ interface TilemapRendererOptions {
|
|
|
4338
4514
|
maskColorMix: number;
|
|
4339
4515
|
opacity: number;
|
|
4340
4516
|
smooth: boolean;
|
|
4341
|
-
|
|
4517
|
+
offset: Vector2;
|
|
4342
4518
|
}
|
|
4343
4519
|
/**
|
|
4344
4520
|
* The TilemapRenderer component renders 2D tile-based maps to the screen.\
|
|
@@ -4354,11 +4530,10 @@ interface TilemapRendererOptions {
|
|
|
4354
4530
|
* layer: "Default",
|
|
4355
4531
|
* tileset: {
|
|
4356
4532
|
* image: this.assetManager.getImage("tileset.png"),
|
|
4357
|
-
* width: 10,
|
|
4358
4533
|
* tileWidth: 32,
|
|
4359
4534
|
* tileHeight: 32,
|
|
4360
|
-
* margin:
|
|
4361
|
-
* spacing:
|
|
4535
|
+
* margin: 0,
|
|
4536
|
+
* spacing: 0
|
|
4362
4537
|
* },
|
|
4363
4538
|
* data: [1, 2, 3, 4],
|
|
4364
4539
|
* chunks: [],
|
|
@@ -4401,17 +4576,23 @@ declare class TilemapRenderer {
|
|
|
4401
4576
|
maskColorMix: number;
|
|
4402
4577
|
/** TRUE for smooth pixels (not recommended for pixel art) */
|
|
4403
4578
|
smooth: boolean;
|
|
4404
|
-
/**
|
|
4405
|
-
|
|
4579
|
+
/** X-Y axis offset */
|
|
4580
|
+
offset: Vector2;
|
|
4406
4581
|
/** @internal */
|
|
4407
4582
|
_processed: boolean;
|
|
4408
4583
|
/** @internal */
|
|
4584
|
+
_dataFromChunks: boolean;
|
|
4585
|
+
/** @internal */
|
|
4409
4586
|
_renderData: TilemapRenderData[];
|
|
4410
|
-
/** Maps each animated tile id to the tile id currently displayed. @internal */
|
|
4411
|
-
_tileAnimationState: Map<number, number>;
|
|
4412
4587
|
/** @internal */
|
|
4413
4588
|
static componentName: string;
|
|
4414
4589
|
constructor(options?: Partial<TilemapRendererOptions>);
|
|
4590
|
+
/**
|
|
4591
|
+
* Processes the tilemap data again, to apply the changes made to it at runtime.\
|
|
4592
|
+
* The array that was generated from the other one is emptied, so it is generated again.\
|
|
4593
|
+
* This operation is expensive, avoid calling it on every frame.
|
|
4594
|
+
*/
|
|
4595
|
+
refresh(): void;
|
|
4415
4596
|
}
|
|
4416
4597
|
/**
|
|
4417
4598
|
* TileAnimation configuration
|
|
@@ -4431,18 +4612,23 @@ interface TileAnimationOptions {
|
|
|
4431
4612
|
}
|
|
4432
4613
|
/**
|
|
4433
4614
|
* TileAnimation cycles a tile through a sequence of tile ids from the tileset.\
|
|
4434
|
-
* It is assigned to a {@link
|
|
4615
|
+
* It is assigned to a {@link Tileset} keyed by the tile id that should animate,\
|
|
4616
|
+
* so every tilemap using that tileset plays the animation in sync.
|
|
4435
4617
|
* @public
|
|
4436
4618
|
* @category Components Configuration
|
|
4437
4619
|
* @example
|
|
4438
4620
|
* ```js
|
|
4439
4621
|
* const tilemapRenderer = new TilemapRenderer({
|
|
4440
|
-
* tileset: {
|
|
4622
|
+
* tileset: {
|
|
4623
|
+
* image: "tileset.png",
|
|
4624
|
+
* tileWidth: 32,
|
|
4625
|
+
* tileHeight: 32,
|
|
4626
|
+
* animations: new Map([
|
|
4627
|
+
* [3, new TileAnimation({ tiles: [3, 4, 5], fps: 6 })]
|
|
4628
|
+
* ])
|
|
4629
|
+
* },
|
|
4441
4630
|
* data: [1, 2, 3, 4],
|
|
4442
|
-
* width: 2
|
|
4443
|
-
* animations: new Map([
|
|
4444
|
-
* [3, new TileAnimation({ tiles: [3, 4, 5], fps: 6 })]
|
|
4445
|
-
* ])
|
|
4631
|
+
* width: 2
|
|
4446
4632
|
* });
|
|
4447
4633
|
* ```
|
|
4448
4634
|
*/
|
|
@@ -4459,22 +4645,36 @@ declare class TileAnimation {
|
|
|
4459
4645
|
}
|
|
4460
4646
|
/**
|
|
4461
4647
|
* The Tileset configuration defines the properties of a tileset used by the TilemapRenderer.\
|
|
4462
|
-
* It specifies the source image containing the tiles, the
|
|
4463
|
-
* and optional margin and spacing
|
|
4464
|
-
*
|
|
4648
|
+
* It specifies the source image containing the tiles, the size of the individual tiles,\
|
|
4649
|
+
* and the optional margin and spacing of the image. The number of columns of the tileset\
|
|
4650
|
+
* is obtained from the image. The tileset cannot be updated at runtime.
|
|
4465
4651
|
* @public
|
|
4466
4652
|
* @category Components Configuration
|
|
4653
|
+
* @example
|
|
4654
|
+
* ```js
|
|
4655
|
+
* // a tileset of 16x16 tiles extruded by 1 pixel
|
|
4656
|
+
* const tileset = {
|
|
4657
|
+
* image: this.assetManager.getImage("tileset.png"),
|
|
4658
|
+
* tileWidth: 16,
|
|
4659
|
+
* tileHeight: 16,
|
|
4660
|
+
* margin: 1,
|
|
4661
|
+
* spacing: 2
|
|
4662
|
+
* };
|
|
4663
|
+
* ```
|
|
4467
4664
|
*/
|
|
4468
4665
|
type Tileset = {
|
|
4469
4666
|
/** The tileset image element */
|
|
4470
4667
|
image: HTMLImageElement | string;
|
|
4471
|
-
width: number;
|
|
4472
4668
|
tileWidth: number;
|
|
4473
4669
|
tileHeight: number;
|
|
4474
|
-
/**
|
|
4475
|
-
margin?:
|
|
4476
|
-
/**
|
|
4477
|
-
spacing?:
|
|
4670
|
+
/** Space in pixels between the tiles and the four edges of the image */
|
|
4671
|
+
margin?: number;
|
|
4672
|
+
/** Space in pixels between adjacent tiles */
|
|
4673
|
+
spacing?: number;
|
|
4674
|
+
/** Animated tiles, keyed by the tile id to animate */
|
|
4675
|
+
animations?: Map<number, TileAnimation>;
|
|
4676
|
+
/** Maps each animated tile id to the tile id currently displayed. @internal */
|
|
4677
|
+
_animationState?: Map<number, number>;
|
|
4478
4678
|
};
|
|
4479
4679
|
/**
|
|
4480
4680
|
* Chunk of tile data
|
|
@@ -5195,4 +5395,4 @@ declare const SYMBOLS: {
|
|
|
5195
5395
|
TimeManager: symbol;
|
|
5196
5396
|
};
|
|
5197
5397
|
|
|
5198
|
-
export { Animation, type AnimationOptions, type AnimationSlice, Animator, type AnimatorOptions, type Archetype, AssetManager, AudioPlayer, type AudioPlayerOptions, type AudioSource, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, DarknessRenderer, type DarknessRendererOptions, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, GeometricRenderer, type GeometricRendererOptions, GeometricShape, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, SYMBOLS, Scene, SceneManager, type SceneType, type SearchResult, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, type System, type SystemGroup, SystemManager, type SystemType, TextAlignment, TextRenderer, type TextRendererOptions, TileAnimation, type TileAnimationOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, debugRenderLayer, decorate, defaultRenderLayer, defaultTextureAtlasOptions, degreesToRadians, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, playSfx, radiansToDegrees, randomFloat, randomInt, range, rgbToHex, stopSfx };
|
|
5398
|
+
export { Animation, type AnimationOptions, type AnimationSlice, Animator, type AnimatorOptions, type Archetype, AssetManager, AudioPlayer, type AudioPlayerOptions, type AudioSource, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, DarknessRenderer, type DarknessRendererOptions, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, GeometricRenderer, type GeometricRendererOptions, GeometricShape, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, SYMBOLS, Scene, SceneManager, type SceneType, type SearchResult, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, type System, type SystemGroup, SystemManager, type SystemType, TextAlignment, TextRenderer, type TextRendererOptions, TileAnimation, type TileAnimationOptions, type TiledChunk, type TiledGroupLayer, type TiledLayer, type TiledObject, type TiledObjectBlueprint, type TiledObjectFactory, type TiledObjectLayer, type TiledObjectProperties, type TiledProperty, type TiledTileAnimationFrame, type TiledTilemap, type TiledTileset, type TiledTilesetTile, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, debugRenderLayer, decorate, defaultRenderLayer, defaultTextureAtlasOptions, degreesToRadians, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, playSfx, radiansToDegrees, randomFloat, randomInt, range, rgbToHex, stopSfx };
|