duckengine
Version:
A 2D Game Engine for the web.
72 lines (71 loc) • 2.36 kB
TypeScript
import { Duck } from '../../../index';
import Game from '../../game';
import GameObject from '../gameObject';
import Vector2 from '../../math/vector2';
import Scene from '../../scene';
/**
* @class Particle
* @classdesc Creates a DuckEngine Particle
* @description The Particle Class. A particle that can be emitted by a ParticleEmitter
* @extends GameObject
* @since 1.0.0
*/
export default class Particle extends GameObject<'either'> {
/**
* @memberof Particle
* @description The float velocity of the Particle
* @type Vector2
* @since 2.0.0
*/
floatVelocity: Vector2;
/**
* @memberof Particle
* @description The original fill color or img path of the Particle
* @type Vector2
* @since 2.0.0
*/
originalFillColorOrIMGPath: string;
/**
* @memberof Particle
* @description The age of the particle in seconds
* @property
* @since 1.0.0
*/
age: number;
/**
* @constructor Particle
* @description Creates a Particle instance
* @param {Duck.Types.Collider.ShapeString} shape Shape of the particle
* @param {number} w Width of the particle
* @param {number} h Height of the particle
* @param {number} r Radius of the particle
* @param {string} fillColorOrIMGPath Color to fill the particle with, can be an image path
* @param {Game} game Game instance
* @param {Scene} scene Scene instance
* @since 1.0.0-beta
*/
constructor(shape: Duck.Types.Collider.ShapeString, w: number, h: number, r: number, fillColorOrIMGPath: string, game: Game, scene: Scene);
/**
* @memberof Particle
* @description Draws the particle. Do not call manually, called automatically in scene loop
* @since 1.0.0-beta
*/
_draw(): void;
/**
* @memberof Particle
*
* *Modified from gameobject*
*
* @description Updates the gameobject's position by the velocity. Sets velocity to 0 on every tick.
* DO NOT CALL MANUALLY, CALLED IN SCENE.__tick(deltaTime)
* @since 2.0.0
*/
_update(): void;
/**
* @memberof Particle
* @description Sets the particle's image src. Only works if particle's shape was initially 'sprite'
* @param {string} imagePath Image path
* @since 1.0.0-beta
*/
setImagePath(imagePath: string): void;
}