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

7 years ago by jeffreybiles


I'm wanting to create a dashboard entity so that I don' t have to clutter my main 'draw' function with a dozen more lines of code. So I try to spawn a dashboard entity every time I load a level:
	loadLevel: function( data ) {

And here is the first trial of my dashboard file:

  EntityDashboard = ig.Entity.extend({
    font: new ig.Font( 'media/helvetica30EEE.png'),
    pos: {x: 5, y: 5},
    spacing: 35,

    draw: function(){
      this.font.draw("$" +, this.pos.x, this.pos.y)
      this.font.draw("+" +, this.pos.x, this.pos.y + this.spacing)

When I go into the weltmeister level editor, it recognized dashboard as an entity. However, when I try and play the game it fails during load and gives me this error in the console:

Uncaught ReferenceError: EntityDashboard is not defined

Anyone have ideas on what might be causing this or how to solve it? I've tested this, and I'm able to spawn any of my old entities in that line.

7 years ago by lachsen

You need to put 'game.entities.dashboard' in the requires() function call in one of your game file (e.g. in your main.js). Otherwise, the source won't be loaded.

It always works in weltmeister, because weltmeister loads all files inside the 'entities' folder automatically.

So maybe that's the problem here?

7 years ago by jeffreybiles

Brilliant! It works!

I didn't have to load any of my other entities, which is why I was confused... then i realized I don't spawn anything else directly, so there's probably some hidden impact code that loads everything in when starting the game loop.

Thanks much!

7 years ago by dominic

Yep, have a look at a level file that is saved from Weltmeister. The level data is wrapped in a module that requires all entities found in that level. The file also contains an array of ig.Image instances, so that the tileset images for the background maps are loaded by Impact's pre-loader.

That's why you don't have to require any other entities from that level - they are required when you require the level itself.

Here's the level from the Jump'n'Run demo, for example:

	LevelTest= /* ... actual level data ... */
		new ig.Image('media/tiles.png')

7 years ago by jeffreybiles

Of course! This also answers my question of why we have to require levels but not entities.

Loving the framework, by the way. I'm getting this new game off the ground quicker than I thought possible.
Page 1 of 1
« first « previous next › last »