DragonBones / DragonBonesJS

DragonBones TypeScript / JavaScript Runtime
MIT License
764 stars 318 forks source link

Phaser: sprite size is always 32x32 #77

Open solusipse opened 6 years ago

solusipse commented 6 years ago

It seems to me that the sprite size is not updated properly during armature initialization. I do something like this to create a new animation:

// Create factory object
var factory = engine.dragonBones.PhaserFactory.factory;

// Load skeleton, texture atlas and texture itself
const skeleton = engine.game.cache.getItem(
    key + "_skeleton",
    Phaser.Cache.JSON
).data;

const atlas = engine.game.cache.getItem(
    key + "_atlas",
    Phaser.Cache.JSON
).data;

const tex = engine.game.cache.getImage(
    key + "_texture", true
).base;

// Parse that data
factory.parseDragonBonesData(skeleton);
factory.parseTextureAtlasData(atlas, tex);

// Build animation
this.armature = factory.buildArmatureDisplay("Armature");

I was looking in several places, like: this.armature.height, this.armature.texture.height, etc. but everywhere I've checked, the size was set to 32x32. Example:

dragonjs-phaser-texture-size

I was able to replicate this with all sprites I had. Is that a legitimate bug or am I doing something wrong? Is there any other field that is used to store width/height information or maybe it has to be calculated manually from slots bounding boxes?