CC Pool
https://docs.cocos.com/creator/2.4/handbook/en/scripting/pooling.html
onLoad: perform () {
this.enemyPool = new cc.NodePool();
let initCount = 5;
for (let i = 0; i < initCount; ++i) {
let enemy = cc.instantiate(this.enemyPrefab); // create node occasion
this.enemyPool.put(enemy); // populate your pool with put methodology
}
}
createEnemy: perform (guardianNode) {
let enemy = null;
if (this.enemyPool.dimension() > 0) { // use dimension methodology to verify if there're nodes accessible within the pool
enemy = this.enemyPool.get();
} else { // if not sufficient node within the pool, we name cc.instantiate to create node
enemy = cc.instantiate(this.enemyPrefab);
}
enemy.guardian = guardianNode; // add new enemy node to the node tree
enemy.getComponent('Enemy').init(); //initialize enemy
}
onEnemyKilled: perform (enemy) {
// enemy ought to be a cc.Node occasion
this.enemyPool.put(enemy); // utilizing the identical put methodology as initializing node pool, this may also name removeFromParent for the node
}
Vinyl
through DEV Community https://dev.to
March 14, 2025 at 08:55AM
-
Product on sale
Audiophile Vinyl Records Cleaning BundleOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Product on sale
Easy Start Vinyl Records Cleaning KitOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Vinyl Records Cleaner Easy Groove Concentrate€34.95 incl. VAT -
Easy Groove Super Set€199.00 incl. VAT -
Easy Groove Enzycaster – vinyl records prewash cleaner€34.95 incl. VAT -
Easy Groove Extreme MK. II- vinyl records prewash cleaner€45.00 incl. VAT -
Vinyl Records Cleaner – Easy Groove Virgin Concentrate€35.00 incl. VAT -
Easy Groove Spray&Wipe vinyl records cleaner€34.95 incl. VAT








