1 decade ago by John
I'm using pooling and this.constructor.prototype is returning as undefined for some reason. Another thing to note is that I'm using AppMobi.js (this is probably the problem).
Any help would be greatly appreciated.
Enitiy:
Any help would be greatly appreciated.
Enitiy:
ig.module ( 'game.entities.laserbolt' ) .requires( 'impact.entity', 'impact.entity-pool' ) .defines(function(){ EntityLaserbolt = ig.Entity.extend({ size: {x: 100, y: 10}, gravityfactor:0, type: ig.Entity.TYPE.NONE, name: "laserbolt", checkAgainst: ig.Entity.TYPE.B, collides: ig.Entity.COLLIDES.PASSIVE, animSheet: new ig.AnimationSheet( 'media/laserbolt.png', 100, 10), init: function( x, y, settings ) { this.parent( x, y, settings ); // Add the animations this.addAnim( 'idle', .1, [0] ); this.maxVel.x = 800; this.maxVel.y = 800; this.vel.x = 800; this.zIndex = 10; this.currentAnim = this.anims.idle; this.boom = new ig.Sound( 'media/sounds/laser-gun-shot-04.mp3' ); this.boom.play(); }, update: function() { if(this.pos.x > (ig.system.width + 108)) { this.kill(); } this.parent(); }, check: function(other){ other.hit('laserbolt'); }, reset: function(x, y, settings){ this.vel.x = 800; this.boom.play(); this.parent(x, y, settings); } }); ig.EntityPool.enableFor( EntityLaserbolt ); });