Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
allow different boxsizes
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Dec 3, 2016
1 parent 8aa3ff0 commit 0be26c3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/animap.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,23 @@ animap.removeById = function(id){
}

function mapAnimationSprite(animationImgName, animationLine, x, y) {
//check if different box
//if animationImgName ends with _number like _32 , _72,
//use this number as boxsize instead of 64
this['box'] = 64;
var tmp = animationImgName.split('_');
tmp = parseInt(tmp[tmp.length-1]);
if(tmp>1){
this['box'] = tmp;
}

this['draw'] = function(){ animap.drawMapAnimation(this) };
this['mapx'] = x * 32;
this['mapy'] = (y - 1) * 32;
this['box'] = 64;
this['img'] = resources.animations[animationImgName];
this['animationLine'] = animationLine;
this['frame'] = 0;
this['maxframe'] = Math.floor(resources.animations[animationImgName].width/64);
this['maxframe'] = Math.floor(resources.animations[animationImgName].width/this['box']);
this['id'] = Math.floor(Math.random()*100000);
}

Expand Down

0 comments on commit 0be26c3

Please sign in to comment.