1 decade ago by jeffreybiles
Hey,
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:
And here is the first trial of my dashboard file:
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.
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 ) { this.parent(data); ig.game.spawnEntity(EntityDashboard) },
And here is the first trial of my dashboard file:
ig.module( 'game.entities.dashboard' ) .requires( 'impact.entity' ) .defines(function(){ EntityDashboard = ig.Entity.extend({ font: new ig.Font( 'media/helvetica30EEE.png'), pos: {x: 5, y: 5}, spacing: 35, draw: function(){ this.font.draw("$" + ig.game.stats.money, this.pos.x, this.pos.y) this.font.draw("+" + ig.game.stats.addition.level, 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.