Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Cavalier

Is it possible to get the default values of an entity without having to spawn one?

I mean, to use ig.game.getEntitiesByType() or ig.game.getEntityByName(), I need to have said entity already present in the current level. However, there are some values that are currently a unit's defaults:
EntitySuperUnit = ig.Entity.extend({
  unitName: 'Super Unit',
  unitPrice: 150,
  trainingTime: 6,

I need to use those in order to actually spawn one.
Is it possible to get those values above without having any superunit present (something like ig.EntitySuperUnit.unitName) or will I have to spawn one, get the values and then kill it?

1 decade ago by Joncom

Without spawning an EntitySuperUnit, you can still access properties like so:

var name = EntitySuperUnit.prototype.unitName;
console.log(name); // Prints "Super Unit".
Page 1 of 1
« first « previous next › last »