-
Notifications
You must be signed in to change notification settings - Fork 142
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
FlxNapeSprite: add support for compound bodies #243
Conversation
If the body is part of a compound, then it's space cannot be changed, instead must be added/removed from the compound bodies list
flixel/addons/nape/FlxNapeSprite.hx
Outdated
@@ -95,6 +95,7 @@ class FlxNapeSprite extends FlxSprite | |||
} | |||
|
|||
/** | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the /**
here was duplicated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh crap, fixing
Any nape demo or code I could use to test this with? |
I can make a quick example if you like. |
flixel/addons/nape/FlxNapeSprite.hx
Outdated
@@ -116,10 +121,14 @@ class FlxNapeSprite extends FlxSprite | |||
{ | |||
super.revive(); | |||
|
|||
if (body != null) | |||
if (body != null && body.compound == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure it shouldn't look like this?
if (body != null)
{
if (body.compound == null)
body.space = FlxNapeSpace.space;
else
body.compound.bodies.add(body);
}
Right now it would add null
to compound.bodies
.
Added support for compound bodies
@Gama11 : https://github.com/thegoodideaco/FlxNapeSpriteTest for an example. |
Thanks!
|
Any update? :) |
Should be ready to rock |
c.active = false; | ||
}); | ||
|
||
if (body.compound == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code section looks like an exact copy of the one in revive()
.
The most recent commit doesn't seem to have any impact on the
|
This is odd, let me look |
i think we need to add an additional property to store any compound it might be apart of. If we disable physics, we have to remove it from the compound instead of from space. We need something to reference if they enable physics again |
Hm... this is getting pretty complex. I should finally get around to setting up unit tests for flixel-addons so we can test all these different cases.. |
I agree |
Closing this for now since there's still some unresolved issues, I created an issue as a reminder: #321 |
If the body is part of a compound, then it's space cannot be changed, instead must be added/removed from the compound bodies list