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

Fix FlxG.removeCamera does not remove the camera from FlxG.cameras #118

Merged
merged 2 commits into from
Nov 5, 2012

Conversation

Dovyski
Copy link
Member

@Dovyski Dovyski commented Oct 9, 2012

I've tested it using this demo: https://github.com/phmongeau/SplitScreen

Fix:
#1
AdamAtomic#231

@moly
Copy link
Member

moly commented Oct 9, 2012

I would recommend using FlxG._game.contains to check if the camera sprite is added. It's much neater than catching exceptions.

FlxG.cameraRemove() now uses FlxG._game.contains() to check if the camera exists in the display list (better than catching exceptions).

FlxCamera.destroy() checks if the "screen" property was not already destroyed before it tries to nullify it. It prevents a crash when FlxG.removeCamera() tries to remove and destroy an already removed (and destroyed) camera.
@Dovyski
Copy link
Member Author

Dovyski commented Oct 11, 2012

I agree. That try...catch block was already there, but its a good idea to replace it. I used the same commit to fix a crash when FlxG.removeCamera() is called with an already removed (and destroyed) camera.

moly added a commit that referenced this pull request Nov 5, 2012
Fix FlxG.removeCamera does not remove the camera from FlxG.cameras
@moly moly merged commit 04a02ff into FlixelCommunity:dev Nov 5, 2012
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

Successfully merging this pull request may close these issues.

2 participants