1 decade ago by DanielGray
Hey, I'm working on a Chrome Web Store game that uses fairly large Spritesheets.
The size of the sheets is roughly 7000x4000 on average and the game runs very well.
I'm using multiple smaller spritesheets to contain the animations as such:
And to draw the animations...
The main problem I am having is that when I use each sheet for the first time, it lags/loads it, but afterwards, the game is completely smooth with no lag.
My question is how do I fix this initial lag? And more importantly, can I load the base spritesheets BEFORE using them in game. Ideally I'd load all animation sheets fully before the player can do anything.
Thanks,
Dan
The size of the sheets is roughly 7000x4000 on average and the game runs very well.
I'm using multiple smaller spritesheets to contain the animations as such:
//This is in .defines Entity animSheet_1: new ig.AnimationSheet( 'media/characters/player/evelyn/Evelyn_Sheet_1.png', 1400, 1000), animSheet_2: new ig.AnimationSheet( 'media/characters/player/evelyn/Evelyn_Sheet_2.png', 1400, 1000), animSheet_3: new ig.AnimationSheet( 'media/characters/player/evelyn/Evelyn_Sheet_3.png', 1400, 1000),
And to draw the animations...
//This is in init() for the entity this.idleAnim = new ig.Animation( this.animSheet_1, 0.1, [0,0,0,0,0,1,1,2,2,2,2,1,1]); this.movAnim = new ig.Animation( this.animSheet_1, 0.05, [3,4,5,6,7,8,9,10,11,12,13,14,15,16]); this.crouchAnim = new ig.Animation( this.animSheet_1, 0.1, [17,17,17,17,18,19,19,19,19,18]); this.prejumpAnim = new ig.Animation( this.animSheet_2, 0.06, [2,3,4,5,6,7,8]); this.risingAnim = new ig.Animation( this.animSheet_2, 0.06, [9,10]); this.fallingAnim = new ig.Animation( this.animSheet_2, 0.06, [11,12]); this.landingAnim = new ig.Animation( this.animSheet_2, 0.06, [13,14,15,16,17,18]); this.kickNeutralAnim = new ig.Animation( this.animSheet_3, 0.07, [0,1,2,3,4,5,6,7,8,9,10,11]); this.weaponAtkNeutral = new ig.Animation( this.animSheet_3, 0.07, [12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]);
The main problem I am having is that when I use each sheet for the first time, it lags/loads it, but afterwards, the game is completely smooth with no lag.
My question is how do I fix this initial lag? And more importantly, can I load the base spritesheets BEFORE using them in game. Ideally I'd load all animation sheets fully before the player can do anything.
Thanks,
Dan