angry-pixel 1.2.4 → 1.2.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/component/Sprite.d.ts +3 -31
- package/lib/component/collider/Collider.d.ts +4 -2
- package/lib/component/collider/TilemapCollider.d.ts +2 -1
- package/lib/component/rendering/TiledTilemapRenderer.d.ts +4 -3
- package/lib/component/rendering/TilemapRenderer.d.ts +3 -2
- package/lib/index.cjs.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,50 +1,22 @@
|
|
|
1
|
+
import { Vector2 } from "angry-pixel-math";
|
|
1
2
|
import { Slice } from "angry-pixel-2d-renderer";
|
|
2
3
|
export { Slice };
|
|
3
|
-
/**
|
|
4
|
-
* Sprite configuration options
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
4
|
export interface SpriteConfig {
|
|
8
|
-
/** The image element to render */
|
|
9
5
|
image: HTMLImageElement;
|
|
10
|
-
|
|
6
|
+
scale?: Vector2;
|
|
11
7
|
slice?: Slice;
|
|
12
|
-
/** Smoothing pixels (not recommended for pixel art) */
|
|
13
8
|
smooth?: boolean;
|
|
14
9
|
}
|
|
15
|
-
/**
|
|
16
|
-
* The Sprite is an object that is composed of the Image element and allow to slice it and smooth its pixels.
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
* @example
|
|
20
|
-
* ```js
|
|
21
|
-
* const sprite = new Sprite({image: this.assetManager.getImage("image.png")});
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```js
|
|
26
|
-
* const sprite = new Sprite({
|
|
27
|
-
* image: this.assetManager.getImage("image.png"),
|
|
28
|
-
* slice: {x: 0, y:0, width: 16, height: 16},
|
|
29
|
-
* smooth: false
|
|
30
|
-
* });
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
10
|
export declare class Sprite {
|
|
34
|
-
/** The image element to render */
|
|
35
11
|
readonly image: HTMLImageElement;
|
|
36
|
-
/** Cut the image based on straight coordinates starting from the top left downward */
|
|
37
12
|
readonly slice: Slice;
|
|
38
|
-
/** Smoothing pixels (not recommended for pixel art) */
|
|
39
13
|
readonly smooth: boolean;
|
|
14
|
+
scale?: Vector2;
|
|
40
15
|
private _width;
|
|
41
16
|
private _height;
|
|
42
17
|
private _loaded;
|
|
43
18
|
constructor(config: SpriteConfig);
|
|
44
|
-
/** The image width */
|
|
45
19
|
get width(): number;
|
|
46
|
-
/** The image height */
|
|
47
20
|
get height(): number;
|
|
48
|
-
/** TRUE if the image is loaded */
|
|
49
21
|
get loaded(): boolean;
|
|
50
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ColliderComponent, RenderComponent } from "../../core/Component";
|
|
2
2
|
import { GameObject } from "../../core/GameObject";
|
|
3
|
-
import { ICollisionResolution, ICollider } from "angry-pixel-2d-physics";
|
|
3
|
+
import { ICollisionResolution, ICollider, ICollision } from "angry-pixel-2d-physics";
|
|
4
4
|
/**
|
|
5
5
|
* Information about the collision
|
|
6
6
|
* @public
|
|
@@ -17,6 +17,8 @@ export interface CollisionData {
|
|
|
17
17
|
* @return The object on the other side of the collision.
|
|
18
18
|
*/
|
|
19
19
|
getGameObject: <T extends GameObject>() => T;
|
|
20
|
+
/** The collider belonging to the queried component */
|
|
21
|
+
localCollider: ICollider;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Every collider component implements this interface.
|
|
@@ -74,7 +76,7 @@ export declare abstract class BaseCollider extends ColliderComponent implements
|
|
|
74
76
|
* @returns The collection of collision data
|
|
75
77
|
*/
|
|
76
78
|
getCollisionsWithLayer(layer: string): CollisionData[];
|
|
77
|
-
|
|
79
|
+
protected createCollisionData(collision: ICollision): CollisionData;
|
|
78
80
|
protected onActiveChange(): void;
|
|
79
81
|
protected onDestroy(): void;
|
|
80
82
|
}
|
|
@@ -26,7 +26,8 @@ export interface TilemapColliderOptions extends InitOptions {
|
|
|
26
26
|
debug?: boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Generates
|
|
29
|
+
* Generates rectangle colliders for the map edge tiles (or lines if composite is TRUE).
|
|
30
|
+
* **Limitations:** At the moment, it is not possible to modify the shape, position, scale and rotation of the collider once it has been generated.
|
|
30
31
|
* @public
|
|
31
32
|
* @category Components
|
|
32
33
|
* @example
|
|
@@ -34,8 +34,8 @@ export interface TiledTilemapRendererOptions {
|
|
|
34
34
|
tilemapLayer: string;
|
|
35
35
|
/** The Tileset instance */
|
|
36
36
|
tileset: Tileset;
|
|
37
|
-
tileWidth
|
|
38
|
-
tileHeight
|
|
37
|
+
tileWidth?: number;
|
|
38
|
+
tileHeight?: number;
|
|
39
39
|
/** The render layer */
|
|
40
40
|
layer?: string;
|
|
41
41
|
/** Direction in which the tilemap will be rendered. */
|
|
@@ -89,6 +89,7 @@ export interface TiledTilemapRendererOptions {
|
|
|
89
89
|
* ```
|
|
90
90
|
*/
|
|
91
91
|
export declare class TiledTilemapRenderer extends RenderComponent implements ITilemapRenderer {
|
|
92
|
+
private readonly spriteDefaultScale;
|
|
92
93
|
/**
|
|
93
94
|
* Id of tiles separated by commas. The ids start at 1, and increment from left to right,
|
|
94
95
|
* from top to bottom. ID 0 (zero) represents a space with no tile.
|
|
@@ -126,7 +127,7 @@ export declare class TiledTilemapRenderer extends RenderComponent implements ITi
|
|
|
126
127
|
*/
|
|
127
128
|
realHeight: number;
|
|
128
129
|
private tiledData;
|
|
129
|
-
private
|
|
130
|
+
private tiledLayer;
|
|
130
131
|
private tileset;
|
|
131
132
|
private layer;
|
|
132
133
|
private smooth?;
|
|
@@ -61,8 +61,8 @@ export interface TilemapRendererOptions {
|
|
|
61
61
|
/** The Tileset instance */
|
|
62
62
|
tileset: Tileset;
|
|
63
63
|
width: number;
|
|
64
|
-
tileWidth
|
|
65
|
-
tileHeight
|
|
64
|
+
tileWidth?: number;
|
|
65
|
+
tileHeight?: number;
|
|
66
66
|
/** The render layer */
|
|
67
67
|
layer?: string;
|
|
68
68
|
/** Direction in which the tilemap will be rendered. */
|
|
@@ -128,6 +128,7 @@ export interface ITilemapRenderer {
|
|
|
128
128
|
* ```
|
|
129
129
|
*/
|
|
130
130
|
export declare class TilemapRenderer extends RenderComponent implements ITilemapRenderer {
|
|
131
|
+
private readonly spriteDefaultScale;
|
|
131
132
|
/** Id of tiles separated by commas. The ids start at 1, and increment from left to right,
|
|
132
133
|
* from top to bottom. ID 0 (zero) represents a space with no tile. */
|
|
133
134
|
tiles: number[];
|