1 decade ago by Bushstar
I am spawning an entity using the init function in main.js. The draw function of the created entity are not being called automatically. Currently I am calling the entities draw function manually from main.js own update function.
What am I doing that is stopping the draw function from being called? With a bit of testing I can see that the update function is not being called either.
I'm creating the entity like this.
I'm creating the entity below. Currently it is an 150px square translucent gray image.
What am I doing that is stopping the draw function from being called? With a bit of testing I can see that the update function is not being called either.
I'm creating the entity like this.
this.ammohud = ig.game.spawnEntity(EntityAmmohud, 20, ig.system.height - 170);
I'm creating the entity below. Currently it is an 150px square translucent gray image.
ig.module( 'game.entities.ammohud' ) .requires( 'impact.entity' ) .defines(function(){ EntityAmmohud = ig.Entity.extend({ image: new ig.Image('media/ammohud.png'), size: {x: 150, y: 150}, init: function( x, y, settings ) { this.pos.x = x; this.pos.y = y; this.parent(x, y, settings); }, draw: function() { this.parent(); this.image.draw(this.pos.x, this.pos.y, 0, 0); } }); });