1 decade ago by XTender
Hi,
I added the ready function to my Entity but it doesnt get called at all. Usindg the newest ImpactJS.
I try to use the ready function because when I try to get the width of the Image in the init function I get 0 but in the update I get the real width.
I added the ready function to my Entity but it doesnt get called at all. Usindg the newest ImpactJS.
ig.module( 'game.entities.backgroundtile' ) .requires( 'impact.entity' ) .defines(function(){ EntityBackgroundtile = ig.Entity.extend({ img:null, id:null, init: function(x, y, settings) { this.parent( x, y,settings); this.id = settings.id; this.img = new ig.Image("media/background/green/tile" + this.id + ".png"); }, ready: function() { ig.log("TEST"); this.pos.x = this.id * this.img.width; }, update: function() { this.parent(); this.maxVel.x = 10000; this.vel.x = -100; }, draw: function() { this.parent(); this.img.draw(this.pos.x,this.pos.y); } }); });
I try to use the ready function because when I try to get the width of the Image in the init function I get 0 but in the update I get the real width.