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 davidx

Hi,

I was implementing a spawned animation (copying how it is in the YOSS game) and I get the following error:
Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1
ig.Image.ig.Class.extend.drawTileimage.js:154
ig.Animation.ig.Class.extend.drawanimation.js:100
ig.Entity.ig.Class.extend.drawentity.js:131
ig.Game.ig.Class.extend.drawgame.js:186
MyGame.ig.Game.extend.drawmain.js:100
window.ig.Class.extend.prototypeimpact.js:384
ig.Game.ig.Class.extend.rungame.js:130
ig.System.ig.Class.extend.runsystem.js:101
(anonymous function)impact.js:52

I looked at the YOSS source and ran that and it also throws this error. If I make the animation sheet smaller, the error goes away but then the animation is too small.

Here is the verbatum from explosion.js from the YOSS game. Anyone have any pointers?

ig.module( 
	'game.entities.explosion' 
)
.requires(
	'impact.entity'
)
.defines(function(){

EntityExplosion = ig.Entity.extend({
	size: {x: 48, y: 48},

	type: ig.Entity.TYPE.NONE,
	collides: ig.Entity.COLLIDES.NEVER,
		
	animSheet: new ig.AnimationSheet( 'media/Explode5-m.png', 48, 48),

  init: function( x, y, settings ) {
    //Received the coordinates of the center of the creating entity.
    //Subtract half of the size of the explosion from these numbers
    //in order to center the explosion on top of the entity.
    x = x - (this.size.x/2);
    y = y - (this.size.y/2);
    this.parent( x, y, settings );

    //We only want the explosion animation to loop once so stop is true.
    this.addAnim( 'idle', 0.05, [0,1,2,3,4,5,6,7], true );
    //Start timer so this entity can be killed after 0.5 seconds.
    this.timer = new ig.Timer(0.5);

  },

  update: function(){
    //If it has been more than 0.5 seconds then kill this explosion entity.
    if (this.timer.delta() > 0) {
      this.kill();
    }
    this.parent();
  },

});

});


Thanks,

1 decade ago by MikeL

I suppose I should address that. Well, honestly I've ignored that error for quite some time, since the game functioned ok. The error has been at the bottom of a long to do list. I'll look back into it and see what the problems is.

My guess is that it's because the size of the image (193x97), does not jive well with the size of the frame 48x48. The image should be 192x96 to divide correctly. I'll see if I can alter the image later.

1 decade ago by MikeL

Ok. I made the changes and pushed them to github. The image was corrected to 192x96 and that seemed to fix the problem. Sorry to send you on a tangent for a while, but at least we both know now where that sort of error comes from. ;)

1 decade ago by davidx

Thanks Mike and thanks for the explanation!
Page 1 of 1
« first « previous next › last »