1 decade ago by kaboo
hello,
so i have this grass entity here
it extends this trigger entity
and for some reason the message is not being displayed, the console.errors are logged properly so the check function fires. ive been looking at this for quite some time now and i really cant see the problem - its pretty much just copy pasted version of kill entity from weltmeister tutorial. the font file is located at that path.
so i have this grass entity here
ig.module( 'game.entities.grass' ) .requires( 'game.entities.trigger' ) .defines(function(){ EntityGrass = EntityTrigger.extend({ message: "grass!!!", timer: null, font: new ig.Font( 'media/04b03.font.png' ), check: function(other) { // console.error("yo"); // console.error(this.font); // console.error(this.message); // console.error(ig.system.width/2); // console.error(ig.system.height/2); this.font.draw(this.message, ig.system.width/2, ig.system.height/2); // this.timer = new ig.Timer(2) } // draw: function() { // if(this.timer && this.timer.delta() < 0) { // this.font.draw(this.message, ig.system.width/2, ig.system.height/2) // } // } }); });
it extends this trigger entity
ig.module( 'game.entities.trigger' ) .requires( 'impact.entity' ) .defines(function(){ EntityTrigger = ig.Entity.extend({ _wmDrawBox: true, _wmBoxColor: "rgba(0, 255, 0, 0.5)", _wmScalable: true, size: {x:48, y:48}, checkAgainst: ig.Entity.TYPE.BOTH, type: ig.Entity.TYPE.NONE, collides: ig.Entity.COLLIDES.NEVER, update: function() {} }); });
and for some reason the message is not being displayed, the console.errors are logged properly so the check function fires. ive been looking at this for quite some time now and i really cant see the problem - its pretty much just copy pasted version of kill entity from weltmeister tutorial. the font file is located at that path.