littlejsengine 1.17.5 → 1.17.10

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- MIT License
1
+ LittleJS Engine License (MIT License)
2
2
 
3
- Copyright (c) 2021 Frank Force
3
+ Copyright (c) 2021 Frank Force http://www.frankforce.com
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -22,12 +22,12 @@ SOFTWARE.
22
22
 
23
23
  -------------------------------------------------------------------------------
24
24
 
25
- This project uses the Box2D physics engine, which is licensed under the zlib license.
26
- Copyright (c) 2006 Erin Catto (Box2D)
27
- Copyright (c) 2011 The box2d.js contributors
25
+ Box2D License
26
+
27
+ Copyright (c) 2006-2013 Erin Catto http://www.gphysics.com
28
28
 
29
29
  This software is provided 'as-is', without any express or implied
30
- warranty. In no event will the authors be held liable for any damages
30
+ warranty. In no event will the authors be held liable for any damages
31
31
  arising from the use of this software.
32
32
 
33
33
  Permission is granted to anyone to use this software for any purpose,
@@ -35,9 +35,9 @@ including commercial applications, and to alter it and redistribute it
35
35
  freely, subject to the following restrictions:
36
36
 
37
37
  1. The origin of this software must not be misrepresented; you must not
38
- claim that you wrote the original software. If you use this software
39
- in a product, an acknowledgment in the product documentation would be
40
- appreciated but is not required.
38
+ claim that you wrote the original software. If you use this software
39
+ in a product, an acknowledgment in the product documentation would be
40
+ appreciated but is not required.
41
41
  2. Altered source versions must be plainly marked as such, and must not be
42
- misrepresented as being the original software.
42
+ misrepresented as being the original software.
43
43
  3. This notice may not be removed or altered from any source distribution.
@@ -27,6 +27,10 @@ declare module "littlejsengine" {
27
27
  * - Function called when a sound ends
28
28
  */
29
29
  export type AudioEndedCallback = (source: AudioBufferSourceNode) => any;
30
+ /**
31
+ * - Function to handle a tile collision test
32
+ */
33
+ export type TileCollisionCallback = (tileData: number, pos: Vector2) => any;
30
34
  /**
31
35
  * - Function that processes a medal
32
36
  */
@@ -34,7 +38,11 @@ declare module "littlejsengine" {
34
38
  /**
35
39
  * - Function that processes a particle
36
40
  */
37
- export type ParticleCallbackFunction = (particle: Particle) => any;
41
+ export type ParticleCallback = (particle: Particle) => any;
42
+ /**
43
+ * - Collide callback for particles
44
+ */
45
+ export type ParticleCollideCallback = (particle: Particle, tileData: number, pos: Vector2) => any;
38
46
  /**
39
47
  * LittleJS - The Tiny Fast JavaScript Game Engine
40
48
  * MIT License - Copyright 2021 Frank Force
@@ -137,8 +145,11 @@ declare module "littlejsengine" {
137
145
  * @memberof Engine */
138
146
  export function engineObjectsUpdate(): void;
139
147
  /** Destroy and remove all objects
148
+ * - This can be used to clear out all objects when restarting a level
149
+ * - Objects can override their destroy function to do cleanup or stick around
150
+ * @param {boolean} [immediate] - should attached effects be allowed to die off?
140
151
  * @memberof Engine */
141
- export function engineObjectsDestroy(): void;
152
+ export function engineObjectsDestroy(immediate?: boolean): void;
142
153
  /** Collects all object within a given area
143
154
  * @param {Vector2} [pos] - Center of test area, or undefined for all objects
144
155
  * @param {Vector2|number} [size] - Radius of circle if float, rectangle size if Vector2
@@ -889,12 +900,6 @@ declare module "littlejsengine" {
889
900
  * @return {number} - Value waving between 0 and amplitude
890
901
  * @memberof Math */
891
902
  export function wave(frequency?: number, amplitude?: number, t?: number, offset?: number): number;
892
- /**
893
- * LittleJS Utility Classes and Functions
894
- * - General purpose utilities
895
- * - Timer - tracks time automatically
896
- * @namespace Utilities
897
- */
898
903
  /** Formats seconds to mm:ss style for display purposes
899
904
  * @param {number} t - time in seconds
900
905
  * @return {string}
@@ -929,6 +934,17 @@ declare module "littlejsengine" {
929
934
  * @param {Function} [callback] - Called when share is complete
930
935
  * @memberof Utilities */
931
936
  export function shareURL(title: string, url: string, callback?: Function): void;
937
+ /** Read save data from local storage
938
+ * @param {string} saveName - unique name for the game/save
939
+ * @param {Object} [defaultSaveData] - default values for save
940
+ * @return {Object}
941
+ * @memberof Utilities */
942
+ export function readSaveData(saveName: string, defaultSaveData?: any): any;
943
+ /** Write save data to local storage
944
+ * @param {string} saveName - unique name for the game/save
945
+ * @param {Object} saveData - object containing data to be saved
946
+ * @memberof Utilities */
947
+ export function writeSaveData(saveName: string, saveData: any): void;
932
948
  /** Random global functions
933
949
  * @namespace Random */
934
950
  /** Returns a random value between the two values passed in
@@ -1265,6 +1281,12 @@ declare module "littlejsengine" {
1265
1281
  * @return {boolean} */
1266
1282
  isValid(): boolean;
1267
1283
  }
1284
+ /**
1285
+ * LittleJS Utility Classes and Functions
1286
+ * - General purpose utilities
1287
+ * - Timer - tracks time automatically
1288
+ * @namespace Utilities
1289
+ */
1268
1290
  /**
1269
1291
  * Timer object tracks how long has passed since it was set
1270
1292
  * @memberof Engine
@@ -1488,7 +1510,7 @@ declare module "littlejsengine" {
1488
1510
  */
1489
1511
  setFullImage(textureInfo?: TextureInfo): TileInfo;
1490
1512
  /**
1491
- * Returns a tile info for an index using this tile as refrence
1513
+ * Returns a tile info for an index using this tile as reference
1492
1514
  * @param {Vector2|number} [index=0]
1493
1515
  * @return {TileInfo}
1494
1516
  */
@@ -1778,7 +1800,7 @@ declare module "littlejsengine" {
1778
1800
  */
1779
1801
  export class FontImage {
1780
1802
  /** Create an image font
1781
- * @param {TileInfo} tileInfo - Tile info of first characeter in font
1803
+ * @param {TileInfo} tileInfo - Tile info of first character in font
1782
1804
  */
1783
1805
  constructor(tileInfo: TileInfo);
1784
1806
  /** @property {TileInfo} - Tile info for the font */
@@ -2416,15 +2438,17 @@ declare module "littlejsengine" {
2416
2438
  additiveColor: any;
2417
2439
  /** @property {boolean} - Should it flip along y axis when rendered */
2418
2440
  mirror: boolean;
2419
- /** @property {number} [mass=objectDefaultMass] - How heavy the object is, static if 0 */
2441
+ /** @property {boolean} - Has object been destroyed? */
2442
+ destroyed: boolean;
2443
+ /** @property {number} - How heavy the object is, static if 0 */
2420
2444
  mass: number;
2421
- /** @property {number} [damping=objectDefaultDamping] - How much to slow down velocity each frame (0-1) */
2445
+ /** @property {number} - How much to slow down velocity each frame (0-1) */
2422
2446
  damping: number;
2423
- /** @property {number} [angleDamping=objectDefaultAngleDamping] - How much to slow down rotation each frame (0-1) */
2447
+ /** @property {number} - How much to slow down rotation each frame (0-1) */
2424
2448
  angleDamping: number;
2425
- /** @property {number} [restitution=objectDefaultRestitution] - How bouncy the object is when colliding (0-1) */
2449
+ /** @property {number} - How bouncy the object is when colliding (0-1) */
2426
2450
  restitution: number;
2427
- /** @property {number} [friction=objectDefaultFriction] - How much friction to apply when sliding (0-1) */
2451
+ /** @property {number} - How much friction to apply when sliding (0-1) */
2428
2452
  friction: number;
2429
2453
  /** @property {number} - How much to scale gravity by for this object */
2430
2454
  gravityScale: number;
@@ -2464,9 +2488,9 @@ declare module "littlejsengine" {
2464
2488
  update(): void;
2465
2489
  /** Render the object, draws a tile by default, automatically called each frame, sorted by renderOrder */
2466
2490
  render(): void;
2467
- /** Destroy this object, destroy its children, detach its parent, and mark it for removal */
2468
- destroy(): void;
2469
- destroyed: number;
2491
+ /** Destroy this object, destroy its children, detach its parent, and mark it for removal
2492
+ * @param {boolean} [immediate] - should attached effects be allowed to die off? */
2493
+ destroy(immediate?: boolean): void;
2470
2494
  /** Convert from local space to world space
2471
2495
  * @param {Vector2} pos - local space point */
2472
2496
  localToWorld(pos: Vector2): Vector2;
@@ -2525,7 +2549,7 @@ declare module "littlejsengine" {
2525
2549
  * @param {EngineObject} child */
2526
2550
  removeChild(child: EngineObject): void;
2527
2551
  /** Check if overlapping another engine object
2528
- * Collisions are resoloved to prevent overlaps
2552
+ * Collisions are resolved to prevent overlaps
2529
2553
  * @param {EngineObject} object
2530
2554
  * @return {boolean} */
2531
2555
  isOverlappingObject(object: EngineObject): boolean;
@@ -2560,27 +2584,34 @@ declare module "littlejsengine" {
2560
2584
  export const tileCollisionLayers: Array<TileCollisionLayer>;
2561
2585
  /** Get tile collision data for a given cell in the grid
2562
2586
  * @param {Vector2} pos
2587
+ * @param {boolean} [solidOnly] - Only check solid layers?
2563
2588
  * @return {number}
2564
2589
  * @memberof TileLayers */
2565
- export function tileCollisionGetData(pos: Vector2): number;
2590
+ export function tileCollisionGetData(pos: Vector2, solidOnly?: boolean): number;
2566
2591
  /** Check if a tile layer collides with another object
2567
- * @param {Vector2} pos
2568
- * @param {Vector2} [size=vec2()]
2569
- * @param {EngineObject} [object] - An object or undefined for generic test
2570
- * @param {boolean} [solidOnly] - Only check solid layers if true
2592
+ * @param {Vector2} pos
2593
+ * @param {Vector2} [size=vec2()]
2594
+ * @param {EngineObject|TileCollisionCallback} [callbackObject] - Callback, engine object, or undefined
2595
+ * @param {boolean} [solidOnly] - Only check solid layers?
2571
2596
  * @return {TileCollisionLayer}
2572
2597
  * @memberof TileLayers */
2573
- export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject, solidOnly?: boolean): TileCollisionLayer;
2598
+ export function tileCollisionTest(pos: Vector2, size?: Vector2, callbackObject?: EngineObject | TileCollisionCallback, solidOnly?: boolean): TileCollisionLayer;
2599
+ /**
2600
+ * @callback TileCollisionCallback - Function to handle a tile collision test
2601
+ * @param {number} tileData - the value of the tile at the position
2602
+ * @param {Vector2} pos - world space position of tile where the collision occurred
2603
+ * @memberof TileLayers
2604
+ */
2574
2605
  /** Return the exact position of the boundary of first tile hit, undefined if nothing was hit.
2575
- * The point will be inside the colliding tile if it hits (may have a tiny shift)
2576
- * @param {Vector2} posStart
2577
- * @param {Vector2} posEnd
2578
- * @param {EngineObject} [object] - An object or undefined for generic test
2579
- * @param {Vector2} [normal] - Optional normal of the surface hit
2580
- * @param {boolean} [solidOnly=true] - Only check solid layers if true
2606
+ * The point will be inside the colliding tile if it hits
2607
+ * @param {Vector2} posStart
2608
+ * @param {Vector2} posEnd
2609
+ * @param {EngineObject|TileCollisionCallback} [callbackObject] - Callback, engine object, or undefined
2610
+ * @param {Vector2} [normal] - Optional normal of the surface hit
2611
+ * @param {boolean} [solidOnly=true] - Only check solid layers?
2581
2612
  * @return {Vector2|undefined} - position of the center of the tile hit or undefined if no hit
2582
2613
  * @memberof TileLayers */
2583
- export function tileCollisionRaycast(posStart: Vector2, posEnd: Vector2, object?: EngineObject, normal?: Vector2, solidOnly?: boolean): Vector2 | undefined;
2614
+ export function tileCollisionRaycast(posStart: Vector2, posEnd: Vector2, callbackObject?: EngineObject | TileCollisionCallback, normal?: Vector2, solidOnly?: boolean): Vector2 | undefined;
2584
2615
  /**
2585
2616
  * Load tile layers from exported data
2586
2617
  * @param {Object} tileMapData - Level data from exported data
@@ -2645,6 +2676,8 @@ declare module "littlejsengine" {
2645
2676
  context: OffscreenCanvasRenderingContext2D;
2646
2677
  /** @property {TextureInfo} - Texture info to use for this object rendering */
2647
2678
  textureInfo: TextureInfo;
2679
+ /** Destroy this canvas layer */
2680
+ destroy(): void;
2648
2681
  /** Draw this canvas layer centered in world space, with color applied if using WebGL
2649
2682
  * @param {Vector2} pos - Center in world space
2650
2683
  * @param {Vector2} [size] - Size in world space
@@ -2790,30 +2823,41 @@ declare module "littlejsengine" {
2790
2823
  /** Check if collision with another object should occur
2791
2824
  * @param {Vector2} pos
2792
2825
  * @param {Vector2} [size=vec2()]
2793
- * @param {EngineObject} [object]
2826
+ * @param {EngineObject|TileCollisionCallback} [callbackObject] - Callback, engine object, or undefined
2794
2827
  * @return {boolean} */
2795
- collisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): boolean;
2828
+ collisionTest(pos: Vector2, size?: Vector2, callbackObject?: EngineObject | TileCollisionCallback): boolean;
2796
2829
  /** Return the exact position of the boundary of first tile hit, undefined if nothing was hit.
2797
2830
  * The point will be inside the colliding tile if it hits (may have a tiny shift)
2798
- * @param {Vector2} posStart
2799
- * @param {Vector2} posEnd
2800
- * @param {EngineObject} [object] - An object or undefined for generic test
2801
- * @param {Vector2} [normal] - Optional normal of the surface hit
2831
+ * @param {Vector2} posStart
2832
+ * @param {Vector2} posEnd
2833
+ * @param {EngineObject|TileCollisionCallback} [callbackObject] - Callback, engine object, or undefined
2834
+ * @param {Vector2} [normal] - Optional normal of the surface hit
2802
2835
  * @return {Vector2|undefined} */
2803
- collisionRaycast(posStart: Vector2, posEnd: Vector2, object?: EngineObject, normal?: Vector2): Vector2 | undefined;
2836
+ collisionRaycast(posStart: Vector2, posEnd: Vector2, callbackObject?: EngineObject | TileCollisionCallback, normal?: Vector2): Vector2 | undefined;
2804
2837
  }
2805
2838
  /**
2806
2839
  * LittleJS Particle System
2840
+ * - A simple but fast and flexible particle system
2841
+ * - Lightweight Particles are created and managed by ParticleEmitters
2842
+ * - The particle design tool can be used to help create emitters
2843
+ * @namespace Particles
2807
2844
  */
2808
2845
  /**
2809
- * @callback ParticleCallbackFunction - Function that processes a particle
2846
+ * @callback ParticleCallback - Function that processes a particle
2810
2847
  * @param {Particle} particle
2811
- * @memberof Engine
2848
+ * @memberof Particles
2849
+ */
2850
+ /**
2851
+ * @callback ParticleCollideCallback - Collide callback for particles
2852
+ * @param {Particle} particle
2853
+ * @param {number} tileData
2854
+ * @param {Vector2} pos
2855
+ * @memberof Particles
2812
2856
  */
2813
2857
  /**
2814
2858
  * Particle Emitter - Spawns particles with the given settings
2815
2859
  * @extends EngineObject
2816
- * @memberof Engine
2860
+ * @memberof Particles
2817
2861
  * @example
2818
2862
  * // create a particle emitter
2819
2863
  * let pos = vec2(2,3);
@@ -2830,7 +2874,7 @@ declare module "littlejsengine" {
2830
2874
  */
2831
2875
  export class ParticleEmitter extends EngineObject {
2832
2876
  /** Create a particle system with the given settings
2833
- * @param {Vector2} position - World space position of the emitter
2877
+ * @param {Vector2} pos - World space position of the emitter
2834
2878
  * @param {number} [angle] - Angle to emit the particles
2835
2879
  * @param {number|Vector2} [emitSize] - World space size of the emitter (float for circle diameter, vec2 for rect)
2836
2880
  * @param {number} [emitTime] - How long to stay alive (0 is forever)
@@ -2858,9 +2902,11 @@ declare module "littlejsengine" {
2858
2902
  * @param {number} [renderOrder] - Render order for particles (additive is above other stuff by default)
2859
2903
  * @param {boolean} [localSpace] - Should it be in local space of emitter (world space is default)
2860
2904
  */
2861
- constructor(position: Vector2, angle?: number, emitSize?: number | Vector2, emitTime?: number, emitRate?: number, emitConeAngle?: number, tileInfo?: TileInfo, colorStartA?: Color, colorStartB?: Color, colorEndA?: Color, colorEndB?: Color, particleTime?: number, sizeStart?: number, sizeEnd?: number, speed?: number, angleSpeed?: number, damping?: number, angleDamping?: number, gravityScale?: number, particleConeAngle?: number, fadeRate?: number, randomness?: number, collideTiles?: boolean, additive?: boolean, randomColorLinear?: boolean, renderOrder?: number, localSpace?: boolean);
2905
+ constructor(pos: Vector2, angle?: number, emitSize?: number | Vector2, emitTime?: number, emitRate?: number, emitConeAngle?: number, tileInfo?: TileInfo, colorStartA?: Color, colorStartB?: Color, colorEndA?: Color, colorEndB?: Color, particleTime?: number, sizeStart?: number, sizeEnd?: number, speed?: number, angleSpeed?: number, damping?: number, angleDamping?: number, gravityScale?: number, particleConeAngle?: number, fadeRate?: number, randomness?: number, collideTiles?: boolean, additive?: boolean, randomColorLinear?: boolean, renderOrder?: number, localSpace?: boolean);
2906
+ /** @property {boolean} - Should particles be emitted in a circle */
2907
+ emitCircle: boolean;
2862
2908
  /** @property {number|Vector2} - World space size of the emitter (float for circle diameter, vec2 for rect) */
2863
- emitSize: number | Vector2;
2909
+ emitSize: Vector2;
2864
2910
  /** @property {number} - How long to stay alive (0 is forever) */
2865
2911
  emitTime: number;
2866
2912
  /** @property {number} - How many particles per second to spawn, does not emit if 0 */
@@ -2899,64 +2945,86 @@ declare module "littlejsengine" {
2899
2945
  localSpace: boolean;
2900
2946
  /** @property {number} - If non zero the particle is drawn as a trail, stretched in the direction of velocity */
2901
2947
  trailScale: number;
2902
- /** @property {ParticleCallbackFunction} - Callback when particle is destroyed */
2903
- particleDestroyCallback: any;
2904
- /** @property {ParticleCallbackFunction} - Callback when particle is created */
2948
+ /** @property {ParticleCallback} - Callback when particle is created */
2905
2949
  particleCreateCallback: any;
2906
- /** @property {number} - Track particle emit time */
2907
- emitTimeBuffer: number;
2950
+ /** @property {ParticleCallback} - Callback when particle is destroyed */
2951
+ particleDestroyCallback: any;
2952
+ /** @property {ParticleCollideCallback} - Callback when particle collides */
2953
+ particleCollideCallback: any;
2908
2954
  /** @property {number} - Percentage of velocity to pass to particles (0-1) */
2909
2955
  velocityInheritance: number;
2956
+ /** @property {number} - Track particle emit time */
2957
+ emitTimeBuffer: number;
2958
+ /** @property {Array<Particle>} - Array of particles for this emitter */
2959
+ particles: any[];
2910
2960
  previousAngle: number;
2911
2961
  previousPos: Vector2;
2912
2962
  /** Spawn one particle
2913
2963
  * @return {Particle} */
2914
2964
  emitParticle(): Particle;
2965
+ /** is emitter actively spawning */
2966
+ isActive(): boolean;
2915
2967
  }
2916
2968
  /**
2917
2969
  * Particle Object - Created automatically by Particle Emitters
2918
- * @extends EngineObject
2919
- * @memberof Engine
2970
+ * @memberof Particles
2920
2971
  */
2921
- export class Particle extends EngineObject {
2972
+ export class Particle {
2922
2973
  /**
2923
2974
  * Create a particle with the passed in settings
2924
2975
  * Typically this is created automatically by a ParticleEmitter
2925
- * @param {Vector2} position - World space position of the particle
2926
- * @param {TileInfo} tileInfo - Tile info to render particles
2927
- * @param {number} angle - Angle to rotate the particle
2928
- * @param {Color} colorStart - Color at start of life
2929
- * @param {Color} colorEnd - Color at end of life
2930
- * @param {number} lifeTime - How long to live for
2931
- * @param {number} sizeStart - Size at start of life
2932
- * @param {number} sizeEnd - Size at end of life
2933
- * @param {number} fadeRate - How quick to fade in/out
2934
- * @param {boolean} additive - Does it use additive blend mode
2935
- * @param {number} trailScale - If a trail, how long to make it
2936
- * @param {ParticleEmitter} [localSpaceEmitter] - Parent emitter if local space
2937
- * @param {ParticleCallbackFunction} [destroyCallback] - Callback when particle dies
2976
+ * @param {ParticleEmitter} emitter - The emitter that created this particle
2977
+ * @param {Vector2} pos - World or local space position
2978
+ * @param {number} angle - Angle of the particle
2979
+ * @param {Color} colorStart - Color at start of life
2980
+ * @param {Color} colorEnd - Color at end of life
2981
+ * @param {number} lifeTime - How long to live for
2982
+ * @param {number} sizeStart - Size at start of life
2983
+ * @param {number} sizeEnd - Size at end of life
2984
+ * @param {Vector2} [velocity] - Velocity of the particle
2985
+ * @param {number} [angleVelocity] - Angular speed of the particle
2938
2986
  */
2939
- constructor(position: Vector2, tileInfo: TileInfo, angle: number, colorStart: Color, colorEnd: Color, lifeTime: number, sizeStart: number, sizeEnd: number, fadeRate: number, additive: boolean, trailScale: number, localSpaceEmitter?: ParticleEmitter, destroyCallback?: ParticleCallbackFunction);
2940
- /** @property {Color} - Color at start of life */
2987
+ constructor(emitter: ParticleEmitter, pos: Vector2, angle: number, colorStart: Color, colorEnd: Color, lifeTime: number, sizeStart: number, sizeEnd: number, velocity?: Vector2, angleVelocity?: number);
2988
+ /** @property {ParticleEmitter} */
2989
+ emitter: ParticleEmitter;
2990
+ /** @property {Vector2} */
2991
+ pos: Vector2;
2992
+ /** @property {number} */
2993
+ angle: number;
2994
+ /** @property {Vector2} */
2995
+ size: Vector2;
2996
+ /** @property {Color} */
2997
+ color: Color;
2998
+ /** @property {Color} */
2941
2999
  colorStart: Color;
2942
- /** @property {Color} - Color at end of life */
3000
+ /** @property {Color} */
2943
3001
  colorEnd: Color;
2944
- /** @property {number} - How long to live for */
3002
+ /** @property {number} */
2945
3003
  lifeTime: number;
2946
- /** @property {number} - Size at start of life */
3004
+ /** @property {number} */
2947
3005
  sizeStart: number;
2948
- /** @property {number} - Size at end of life */
3006
+ /** @property {number} */
2949
3007
  sizeEnd: number;
2950
- /** @property {number} - How quick to fade in/out */
2951
- fadeRate: number;
2952
- /** @property {boolean} - Is it additive */
2953
- additive: boolean;
2954
- /** @property {number} - If a trail, how long to make it */
2955
- trailScale: number;
2956
- /** @property {ParticleEmitter} - Parent emitter if local space */
2957
- localSpaceEmitter: ParticleEmitter;
2958
- /** @property {ParticleCallbackFunction} - Called when particle dies */
2959
- destroyCallback: ParticleCallbackFunction;
3008
+ /** @property {Vector2} */
3009
+ velocity: Vector2;
3010
+ /** @property {number} */
3011
+ angleVelocity: number;
3012
+ /** @property {number} */
3013
+ spawnTime: number;
3014
+ /** @property {boolean} */
3015
+ mirror: boolean;
3016
+ /** @property {EngineObject} */
3017
+ groundObject: TileCollisionLayer;
3018
+ /** @property {boolean} */
3019
+ destroyed: boolean;
3020
+ /** @property {TileInfo} */
3021
+ tileInfo: TileInfo;
3022
+ /** Update the particle */
3023
+ update(): void;
3024
+ /** Destroy this particle */
3025
+ destroy(): void;
3026
+ /** Render the particle, automatically called each frame */
3027
+ render(): void;
2960
3028
  }
2961
3029
  /**
2962
3030
  * LittleJS Medal System
@@ -3112,7 +3180,7 @@ declare module "littlejsengine" {
3112
3180
  export class PostProcessPlugin {
3113
3181
  /** Create global post processing shader
3114
3182
  * @param {string} shaderCode
3115
- * @param {boolean} [includeMainCanvas] - combine mainCanvs onto glCanvas
3183
+ * @param {boolean} [includeMainCanvas] - combine mainCanvas onto glCanvas
3116
3184
  * @param {boolean} [feedbackTexture] - use glCanvas from previous frame as the texture
3117
3185
  * @example
3118
3186
  * // create the post process plugin object
@@ -3255,7 +3323,7 @@ declare module "littlejsengine" {
3255
3323
  nativeHeight: number;
3256
3324
  /** @property {UIObject} - Object currently selected by navigation (gamepad or keyboard) */
3257
3325
  navigationObject: any;
3258
- /** @property {Timer} - Cooldown timer for navigation inputs */
3326
+ /** @property {Timer} - Cool down timer for navigation inputs */
3259
3327
  navigationTimer: Timer;
3260
3328
  /** @property {number} - Time between navigation inputs in seconds */
3261
3329
  navigationDelay: number;
@@ -3399,7 +3467,7 @@ declare module "littlejsengine" {
3399
3467
  lineWidth: number;
3400
3468
  /** @property {number} - Corner radius for rounded rects */
3401
3469
  cornerRadius: number;
3402
- /** @property {string} - Font for this objecct */
3470
+ /** @property {string} - Font for this object */
3403
3471
  font: string;
3404
3472
  /** @property {string} - Font style for this object or undefined */
3405
3473
  fontStyle: any;
@@ -3591,6 +3659,8 @@ declare module "littlejsengine" {
3591
3659
  value: number;
3592
3660
  /** @property {Color} - Color for the handle part of the scrollbar */
3593
3661
  handleColor: Color;
3662
+ /** @property {boolean} - Should it fill up like a progress bar? */
3663
+ fillMode: boolean;
3594
3664
  text: string;
3595
3665
  }
3596
3666
  /**
@@ -3598,7 +3668,7 @@ declare module "littlejsengine" {
3598
3668
  * @extends UIObject
3599
3669
  * @example
3600
3670
  * // Create a video player UI object
3601
- * const video = new VideoPlayerUIObject(vec2(400, 300), vec2(320, 240), 'cutscene.mp4', true);
3671
+ * const video = new VideoPlayerUIObject(vec2(400, 300), vec2(320, 240), 'video.mp4', true);
3602
3672
  * video.play();
3603
3673
  * @memberof UISystem
3604
3674
  */
@@ -3797,6 +3867,8 @@ declare module "littlejsengine" {
3797
3867
  edgeLists: any[];
3798
3868
  /** @property {Array<Object>} - List of all edge loops for default box2d drawing */
3799
3869
  edgeLoops: any[];
3870
+ /** Destroy this object and its physics body */
3871
+ destroy(): void;
3800
3872
  /** Draws all this object's fixtures
3801
3873
  * @param {Color} [color]
3802
3874
  * @param {Color} [lineColor]
@@ -4008,11 +4080,11 @@ declare module "littlejsengine" {
4008
4080
  constructor(pos?: Vector2, size?: Vector2, tileInfo?: TileInfo, angle?: number, color?: Color, renderOrder?: number);
4009
4081
  }
4010
4082
  /**
4011
- * Box2D Kiematic Object - Box2d with a kinematic physics body
4083
+ * Box2D Kinematic Object - Box2d with a kinematic physics body
4012
4084
  * @extends Box2dObject
4013
4085
  * @memberof Box2D
4014
4086
  */
4015
- export class Box2dKiematicObject extends Box2dObject {
4087
+ export class Box2dKinematicObject extends Box2dObject {
4016
4088
  /** Create a LittleJS object with Box2d physics
4017
4089
  * @param {Vector2} [pos]
4018
4090
  * @param {Vector2} [size]