azerion / phaser-spine

A plugin for Phaser 2 that adds Spine support
MIT License
121 stars 57 forks source link

[Spine-TS] Loading in of Spine projects moves the other spine objects that are already on stage #76

Open shibekin69 opened 6 years ago

shibekin69 commented 6 years ago

I noticed this while trying to debug the other problem. When I add in other spine projects of bigger dimensions or with bones and graphics that I've deliberately placed far apart, when adding these in to the stage, other Spine object's x,y positions move about in an unpredictable way. Like pasting in images in a invisible container, and this container auto-resizes or something.

marcusIB commented 6 years ago

Hi, I have the same problem. In my case I instance a spine object in a group and it works correctly but when I instance another spine object, in this case in the stage, the first one (spin in the group) changes his position or maybe his anchor. Otherwise, in another state I had instanced two diferents spine object in the main stage and both works correctly.

spayton commented 6 years ago

It's because they are using the same default texture and its properties.

I fixed it in the .js because I've been modding that rather than the .ts. Find this line in the .js:

            var _this = _super.call(this, game, x, y, '') || this;

and replace it with this:

            var _this = _super.call(this, game, x, y, new PIXI.Texture(new PIXI.BaseTexture)) || this;

or work this mod back up into the .ts