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 ape

Maybe I'm just tired, but I thought I'd be able to create an Entity and then extend that Entity.

For example:

/* game/entities/ghost.js */
// a generic 'Ghost' entity
ig.module(
  'game.entities.ghost'
)
.requires(
  'impact.entity'
)
.defines(function(){
  EntityGhost = ig.Entity.extend({
    // generic props and methods
  });
});

/* game/entities/ghost_blue.js */
// a blue 'Ghost' entity
ig.module(
  'game.entities.ghost_blue'
)
.requires(
  'game.entities.ghost'
)
.defines(function(){
  EntityGhostBlue = ig.EntityGhost.extend({
    // props and methods specific to blue ghosts
  });
});

This, however, doesn't work. It'll produce a "ig.EntityGhost [undefined] is not an object" error.

Am I missing something?

1 decade ago by jminor

Try removing the "ig." like this:

EntityGhostBlue = EntityGhost.extend({

1 decade ago by ape

Sigh.

On the one hand, I'm totally happy that that works. Thanks for the response.

On the other hand, I can't believe I wasted any time at all trying to figure that out. Since I'm extending a "class", the top level ig object isn't necessary.
Page 1 of 1
« first « previous next › last »