angry-pixel 2.3.1 → 2.3.3

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.d.ts CHANGED
@@ -2442,6 +2442,12 @@ interface AudioPlayerOptions {
2442
2442
  fixedToTimeScale: boolean;
2443
2443
  /** TRUE If the audio source should loop. */
2444
2444
  loop: boolean;
2445
+ /** Time mark (seconds) where looping starts. Only has effect when `loop` is TRUE and `loopEnd` is greater than zero. */
2446
+ loopStart: number;
2447
+ /** Time mark (seconds) where looping ends. When `loop` is TRUE and this is greater than zero, the audio loops between `loopStart` and `loopEnd`. */
2448
+ loopEnd: number;
2449
+ /** Time mark (seconds) where playback starts from when playing from a stopped state. Default is 0. */
2450
+ startAt: number;
2445
2451
  /** The volume of the audio source. */
2446
2452
  volume: number;
2447
2453
  }
@@ -2471,10 +2477,18 @@ declare class AudioPlayer {
2471
2477
  fixedToTimeScale: boolean;
2472
2478
  /** TRUE If the audio source should loop. */
2473
2479
  loop: boolean;
2480
+ /** Time mark (seconds) where looping starts. Only has effect when `loop` is TRUE and `loopEnd` is greater than zero. */
2481
+ loopStart: number;
2482
+ /** Time mark (seconds) where looping ends. When `loop` is TRUE and this is greater than zero, the audio loops between `loopStart` and `loopEnd`. */
2483
+ loopEnd: number;
2484
+ /** Time mark (seconds) where playback starts from when playing from a stopped state. Default is 0. */
2485
+ startAt: number;
2474
2486
  /** READONLY, The current state of the audio source. */
2475
2487
  state: "stopped" | "playing" | "paused";
2476
2488
  /** The volume of the audio source. */
2477
2489
  volume: number;
2490
+ /** READONLY, The current playback time mark of the audio source, expressed in seconds. */
2491
+ get currentTime(): number;
2478
2492
  /** READONLY, TRUE If the audio source is playing. */
2479
2493
  get playing(): boolean;
2480
2494
  /** READONLY, TRUE If the audio source is paused. */
@@ -2491,6 +2505,8 @@ declare class AudioPlayer {
2491
2505
  _startedAt: number;
2492
2506
  /** @internal Offset (seconds) within the buffer at which the next play should resume from (used on pause) */
2493
2507
  _pauseOffset: number;
2508
+ /** @internal Current playback time mark (seconds), updated each frame by the AudioPlayerSystem */
2509
+ _currentTime: number;
2494
2510
  /** @internal */
2495
2511
  _playAfterUserInput: boolean;
2496
2512
  /** @internal */
@@ -3154,6 +3170,13 @@ interface RigidBodyOptions {
3154
3170
  * @public
3155
3171
  */
3156
3172
  acceleration: Vector2;
3173
+ /**
3174
+ * Collision layers for which this body behaves as static. When a Dynamic body whose collider layer
3175
+ * is listed here collides with this body, only the other body is repositioned, as if this one were static.
3176
+ * This body still behaves as its own type (e.g. Dynamic) for every other collision.
3177
+ * @public
3178
+ */
3179
+ staticForLayers: string[];
3157
3180
  }
3158
3181
  /**
3159
3182
  * The RigidBody component enables physics simulation for an entity, allowing it to interact with other physics-enabled objects in the game world.\
@@ -3219,6 +3242,13 @@ declare class RigidBody {
3219
3242
  * @public
3220
3243
  */
3221
3244
  acceleration: Vector2;
3245
+ /**
3246
+ * Collision layers for which this body behaves as static. When a Dynamic body whose collider layer
3247
+ * is listed here collides with this body, only the other body is repositioned, as if this one were static.
3248
+ * This body still behaves as its own type (e.g. Dynamic) for every other collision.
3249
+ * @public
3250
+ */
3251
+ staticForLayers: string[];
3222
3252
  /** @internal */
3223
3253
  static componentName: string;
3224
3254
  constructor(options?: Partial<RigidBodyOptions>);
@@ -3460,6 +3490,7 @@ interface TilemapRenderData extends RenderData {
3460
3490
  tiles: number[];
3461
3491
  tilemap: Tilemap;
3462
3492
  tileset: Tileset$1;
3493
+ tileAnimations?: Map<number, number>;
3463
3494
  smooth?: boolean;
3464
3495
  flipHorizontal?: boolean;
3465
3496
  flipVertical?: boolean;
@@ -4307,6 +4338,7 @@ interface TilemapRendererOptions {
4307
4338
  maskColorMix: number;
4308
4339
  opacity: number;
4309
4340
  smooth: boolean;
4341
+ animations: Map<number, TileAnimation>;
4310
4342
  }
4311
4343
  /**
4312
4344
  * The TilemapRenderer component renders 2D tile-based maps to the screen.\
@@ -4369,14 +4401,62 @@ declare class TilemapRenderer {
4369
4401
  maskColorMix: number;
4370
4402
  /** TRUE for smooth pixels (not recommended for pixel art) */
4371
4403
  smooth: boolean;
4404
+ /** Animated tiles, keyed by the tile id to animate. */
4405
+ animations: Map<number, TileAnimation>;
4372
4406
  /** @internal */
4373
4407
  _processed: boolean;
4374
4408
  /** @internal */
4375
4409
  _renderData: TilemapRenderData[];
4410
+ /** Maps each animated tile id to the tile id currently displayed. @internal */
4411
+ _tileAnimationState: Map<number, number>;
4376
4412
  /** @internal */
4377
4413
  static componentName: string;
4378
4414
  constructor(options?: Partial<TilemapRendererOptions>);
4379
4415
  }
4416
+ /**
4417
+ * TileAnimation configuration
4418
+ * @public
4419
+ * @category Components Configuration
4420
+ * @example
4421
+ * ```js
4422
+ * const waterAnimation = new TileAnimation({
4423
+ * tiles: [5, 6, 7, 8],
4424
+ * fps: 6
4425
+ * });
4426
+ * ```
4427
+ */
4428
+ interface TileAnimationOptions {
4429
+ tiles: number[];
4430
+ fps?: number;
4431
+ }
4432
+ /**
4433
+ * TileAnimation cycles a tile through a sequence of tile ids from the tileset.\
4434
+ * It is assigned to a {@link TilemapRenderer} keyed by the tile id that should animate.
4435
+ * @public
4436
+ * @category Components Configuration
4437
+ * @example
4438
+ * ```js
4439
+ * const tilemapRenderer = new TilemapRenderer({
4440
+ * tileset: { image: "tileset.png", width: 10, tileWidth: 32, tileHeight: 32 },
4441
+ * data: [1, 2, 3, 4],
4442
+ * width: 2,
4443
+ * animations: new Map([
4444
+ * [3, new TileAnimation({ tiles: [3, 4, 5], fps: 6 })]
4445
+ * ])
4446
+ * });
4447
+ * ```
4448
+ */
4449
+ declare class TileAnimation {
4450
+ /** The sequence of tile ids to cycle through. */
4451
+ tiles: number[];
4452
+ /** The animation speed in frames per second. */
4453
+ fps: number;
4454
+ /** The current frame of the animation. */
4455
+ currentFrame: number;
4456
+ /** The current time of the animation. */
4457
+ currentTime: number;
4458
+ constructor(options?: TileAnimationOptions);
4459
+ }
4380
4460
  /**
4381
4461
  * The Tileset configuration defines the properties of a tileset used by the TilemapRenderer.\
4382
4462
  * It specifies the source image containing the tiles, the dimensions of the tileset and individual tiles,\
@@ -5115,4 +5195,4 @@ declare const SYMBOLS: {
5115
5195
  TimeManager: symbol;
5116
5196
  };
5117
5197
 
5118
- 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, 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 };
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 };