-
Notifications
You must be signed in to change notification settings - Fork 17
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
Missing usage of particleClass in FlxEmitter #95
Conversation
FlxEmitter now uses the custom particle class to recycle instead of FlxParticle. Fixed FlixelCommunity#6, AdamAtomic#226
Looks good to me. On a different note, you still run the risk of the user assigning an object that isn't a |
Looks ok to me too. If think it would be useful to log a warning if a class that isn't a |
Is there a clever way to see if a
|
Easiest way is probably just to put a try catch around |
@moly Since you already have this pull request open, do you want to add that feature, or is it better to keep it separated as a different merge? |
I'll just add it here. |
It will produce several log entries. Shouldn't we create a setter for Additionally I think the log message should display the problematic |
If I may (to compensate for me feeling so helpless in many of the other open pull requests): protected var _particleClass:Class;
public function get particleClass():Class
{
return _particleClass;
}
public function set particleClass(value:Class):void
{
var testParticle:* = new value();
if (testParticle is FlxParticle)
{
_particleClass = value;
}
else
{
FlxG.log("ERROR: " + getQualifiedClassName(testParticle) " must extend FlxParticle in order to be used in a FlxEmitter.");
}
} Adam doesn't use enough getters and setters, and I find that to be a shame. |
Exactly what I had in mind, @IQAndreas. |
Also moved around the error messages for said member.
@moly - Do you want to merge in my It includes the fixes we mentioned here. |
@moly Hey, what did you do with my fancy |
It might be a good idea also changing the ASDoc a tad more so as to resolve the issue #47
That way users don't need to trigger the error before learning about this restriction. |
I agree (it should already be there :) |
I just noticed Flixel has it's own function for retrieving the class name:
Could you add a commit with this change, and include the addition to the ASDoc? |
I think it is useful. The complete class name will make things easier for developers to spot bugs. |
@moly Great! I didn't realize you had already added the commits. I didn't realize this before, but GitHub does not seem to notify when updates are added, only when comments are made. We should probably post a quick comment whenever we add or edit commits. These changes look good to me, so I'll go ahead and merge them in. |
Missing usage of particleClass in FlxEmitter
FlxEmitter now uses the custom particle class to recycle instead of FlxParticle.
Fixed #6, AdamAtomic#226