// update code called every frame
EntityCreator.prototype.update = function(dt) {
// Spawn new cubes if there are less than maxCubes
while (this.entities.length < this.maxCubes) {
this.spawnCube();
}
// Loop through Entities and delete them when their time is up
for (i = 0; i < this.entities.length; i++) {
this.entities[i].timer -= dt;
if (this.entities[i].timer < 0) {
… etc
But that structure seem to rely on ‘.entities’ being a built-in referral to the used list.
I need to construct and use a list that has a not-built-in script-scope.
Such as (more like):
MyScript.attributes.add(‘useFulScopeList’,{ type: ‘list’, default: [ofNumber type?]});
// initialize code called once per entity
EntityCreator.prototype.initialize = function() {
this.entities = [];
};
and in other places boolean).
It could be very useful with a complete list of all workable in-top type-declarations within PlayCanvas (I am not sure that a link to common Javascript applies for me (?) … PlayCanvas is still a subset )
{I want to declare
MyScript.attributes.add(‘useFulScopeList’,{ type: ‘list’, default: [ofNumber type?]});
in the top alongside, eventually, all the other workable/useable declarations types, and not only lists like
this.entities = [];
declared in script body below
}