Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

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:


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 );
 
});

1 decade ago by Joncom

Just want to make sure you&039;re running the latest version of ImpactJS (1.23) because line 58 is not #var proto = this.constructor.prototype;, line 51 is.

1 decade ago by John

I am, it's reporting an error when impact tries to use proto, for example line 56: this.vel.x = proto.vel.x; I've commented this line out, but then it just reports the same error on line 57 and so on. So it must be proto, however I've looked deeper into it and found that it's AppMobis fault, they're using a modified version of impact 1.19 a.k.a impact.min.js. So unless they update that, I don't think my problem will be getting fixed.

Thanks for your time though.

1 decade ago by Joncom

It would be nice if AppMobi updated their version of Impact. However, 1.19 is still pretty solid. And if it's pooling you're after, you could always implement it yourself.
Page 1 of 1
« first « previous next › last »