Hi, I wanted to make a simple notification showing health and possibly other variables using .context. The Notification plugin did not work for me for some reason.

When my Hero or enemies are hit the remaining health is shown above them for some time. I created a simple entity called Note, which you can see here:


ig.module(
	'game.entities.note'
)
.requires(
	'impact.entity'
	
	)
.defines(function(){

EntityNote = ig.Entity.extend({
    	
	type: ig.Entity.TYPE.NONE,
	checkAgainst: ig.Entity.TYPE.NONE, 
	collides: ig.Entity.COLLIDES.NONE,
	
	init: function( x, y, settings ) {
            this.ctx = ig.system.context;
	    this.pos.x = x - ig.game.screen.x;
	    this.pos.y = y - ig.game.screen.y;
	                
	    this.timer = new ig.Timer(0.4);
	    ig.merge( this, settings );
	    
	},
	
	drawHealth: function(){

// Select a different font and color here
		this.ctx.font = "bold 15pt sans-serif";
		this.ctx.fillStyle = "#b00000";
	    
    		this.ctx.fillText(" " + (this.health), this.pos.x, this.pos.y-30);
		
	},
	
	update: function() {

// Update the Note-position
            this.pos.x = ig.system.getDrawPos( this.pos.x );
            this.pos.y = ig.system.getDrawPos( this.pos.y );
            
            this.pos.x += (this.vel.x * ig.system.tick);
	    this.pos.y += (this.vel.y * ig.system.tick);
            
            this.parent();
        },
	
	draw: function() {
	    this.parent();
		
// Call function to draw health info
            if( this.timer.delta() < 0 ){
                this.drawHealth();
	    
	} else {this.kill();}		
	}
        
});

});


To call the entity you should pass the position and velocity of the entity which owns the Note, as well as variables which you want to show. In my case it looks like this:

var settings = {health: other.health, vel: {x: other.vel.x, y: other.vel.y}, flip: other.flip};
ig.game.spawnEntity( EntityNote, other.pos.x, other.pos.y, settings );