Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spine-TS] Spine object affects unrelated group(s)/sprite(s)? #79

Open
shibekin69 opened this issue Aug 31, 2017 · 5 comments
Open

[Spine-TS] Spine object affects unrelated group(s)/sprite(s)? #79

shibekin69 opened this issue Aug 31, 2017 · 5 comments

Comments

@shibekin69
Copy link

shibekin69 commented Aug 31, 2017

This one's a little elusive. I'm not sure how or why, but I'm sure the old phaser-spine doesn't cause this. There are two problems here that may be related to each other:

PROBLEM 1:

I have a bunch of groups that has a mix of groups, text, and sprite objects, that's separate from the group containing the spine object. Let's say we have this:

menuGroup --> This is the menu group containing a mix of groups, texts, and sprites.
bgGroup --> This is another group containing child subgroups for different layers that contains sprites. The sprites aren't related to charGroup.
charGroup --> This group contains groups and spine objects.

*When I say group here, I mean using Phaser's group feature.

In one of the the bgGroup subgroup, let's say bgGroup.layer6, I was tweening its alpha, and noticed that it suddenly affected a spine objects in charGroup. When I tween it to alpha 0, it the spine object followed. When the tween was done, the spine object's alpha went back to 100 while the bgGroup sprite I was tweening remained with alpha 0.

I tried adjusting the alpha of the bgGroup.layer6, and sprite in this subgroup and they both affect all the spine objects on screen.

PROBLEM 2:

In another instance, I noticed one of the subgroups in my menuGroup disappearing. I can't tell exactly when and this seems to happen depending on what's being loaded up. In the title screen, this menu group can be seen, and when I transition to the game state by a load game, it sometimes remains, and sometimes disppears depending on the loaded scene.

EDITED FOR MORE DETAIL.

@shibekin69
Copy link
Author

shibekin69 commented Sep 1, 2017

I looked over the different builds available and found that there's something between these two builds that cause my sprites to disappear:

Added support for multipage atlasses
e91d69a

Direct link to build js: https://raw.githubusercontent.com/orange-games/phaser-spine/e91d69a103673ad5a90047117c047c956f8784a1/build/phaser-spine.js

Added premultiplied alpha support
2aa2370

Direct link to build js: https://raw.githubusercontent.com/orange-games/phaser-spine/2aa2370cf5bbd96e962c3f497623941379f32d75/build/phaser-spine.js

I'll see what might be causing it.

@shibekin69
Copy link
Author

shibekin69 commented Sep 1, 2017

I think I managed to trace the difference that causes the problem.

The earlier 2aa2370 build had this line:

var _this = _super.call(this, game, x, y, PhaserSpine.SpinePlugin.SPINE_NAMESPACE + key) || this;

Then the next e91d69a build had this instead:

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

I tried reverting this line in the latest version and it seems to do the trick for PROBLEM 2. No more disappearing sprite/group containers. This doesn't fix PROBLEM 1 however.

@shibekin69
Copy link
Author

shibekin69 commented Sep 1, 2017

Ok, so when I reverted back to the old code, I'm getting cache.image not found messages. But if I use the new one, I don't get these. However, the new code with the key name blank does cause some of my loaded sprites in the game to "disappear" from view. Of which, I don't know how it's happening. Hmm. But for now, I'll have to try to supress this key from being loaded, since it's trying to do:

spine load key "hero"

when we've changed it to load

spine load key "hero.png", "hero1.png" ...

To support multi page atlases...

@shibekin69
Copy link
Author

@AleBles - how does

_super.call(this, game, x, y, PhaserSpine.SpinePlugin.SPINE_NAMESPACE + key) || this;

work? So Spine extends a Phaser Sprite object, and calling this function will automatically try to look for an existing sprite with above key name?

@shibekin69
Copy link
Author

Ok, well, this works at supressing those error messages. My spine stuff seems to be loading...

var _this = _super.call(this, game, x, y, key + ".png") || this;

The assumption tho, is it's always looking for a png file, so the files are not png, like jpg or gif, there's always an cache.image error message (that won't affect the game, just bothersome messages in the console.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant