A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://impactjs.com/documentation/class-reference/entitypool below:

EntityPool - Impact

Defined in Module impact.entity-pool, inherits from ig.Class

Synopsis
EntityBullet = ig.Entity.extend({
	// ...
});

// Enable Pooling for this Entity Class!
ig.EntityPool.enableFor( EntityBullet );
Description

ig.EntityPool allows you to easily enable pooling for frequently used types of Entities. The EntityPool is global, you don't have to create it, but just enable it for your Entities.

When reviving an Entity from the Pool, Impact will call the Entity's .reset() method, instead of init().

Read more in the Entity Pooling Article.

Functions .enableFor( EntityClass )

Augments the given EntityClass with pooling functionality. This should only be called once for each Entity Class for which you want to enable pooling.

.drainPool( classId )

Removes all Entities with the given .classId from the Pool.

Example:

ig.EntityPool.drainPool( EntityBullet.classId );
.drainAllPools()

Removes all Entities from the Pool.

This function is automatically called by the Game's .loadLevel() method, before the new level is loaded.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4