-
Notifications
You must be signed in to change notification settings - Fork 140
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
FlxWeapon rework #383
base: dev
Are you sure you want to change the base?
FlxWeapon rework #383
Conversation
I also moved those unused fields' doc comments to `FlxWeaponFireFrom`. I'm unsure of whether GitHub renders Markdown in commit messages, so I'll find out with this.
Whoopsie doopsie.
This has breaking changes on a niche, legacy class. At a glance, I see odd things I wouldn't recommend, like using a FlxTimer to control fire rate when I would use a float and add elapsed on update. I recommend making a new class in a new repo and battle-testing it in your game project over the course of it's development and then we can talk about replacing this entirely in a new major version. FlxWeapon was ported from the flash version of flixel back when sh'mups were all the rage, and it isn't used very often, now. If I were making a shoot 'em up, I would probably just make my own system. Looking at the old version and you're version, they're pretty different from my version would look that, and that's fine, but it makes me thing we shouldn't even have an "official haxeflixel version" and just make little repos that people can copy |
Can you list the changes made, and why they were made, @DalekCraft2 ? |
Oh, if you are considering this again, give me a moment. I need to make a few more fixes. |
I think its just confusing becuase of how the diff isnt aligned, well |
You mean how some commits contain changes what were not mentioned in the commit's name? |
I usually dont look at commits individually, just the whole diff ill take a closer look but i know i dont want to have a nother breaking change in flixel-addons this quickly, we had just released 3.0.0. I'd say make the non breaking changes first, and then consider a rewrite in the way i outlined above |
I would have used |
Here are the changes what I made and why I made them:
|
I'm going to side with @Geokureli here and say that Doing a little poking around in |
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.
no breaking changes can be introduced in this PR
Agree with all of this.
Got more examples? |
I did not reimplement one of the variables, |
@DalekCraft2 I made some changes Passed in objects used as the return value are typically named when editing doc comments use the following formatting:
here's an example, in my VSCode editor with "Render Whitespace" set to "boundary' another example of param description indenting |
*/ | ||
var bulletFactory:FlxTypedWeapon<TBullet>->TBullet; | ||
|
||
var lastFired:Int = 0; |
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.
removing this is technically a breaking change but i'll allow it. In all likelyhood no real person will have a compile error unless they use this field in an extending class, and highly unlikely and easy to fix.
In the future, when in doubt, just deprecate it
when making these changes did you have a project you used to test them out? If so, is it small and public? Can you share it? I try to make a public test state for every feature, fix, or improvement I make to flixel, and use it to help others, or make unit tests. Here's an example: HaxeFlixel/flixel#2768 If you don't have a small one, I'll make my own, but it might take a bit as I'm busy with work atm |
I had originally made the Also, it would probably be a bad idea for you to test it with Quench because I use my awful Git habits over there constantly. By this point, every Haxe file in the VS Code directory viewer has a yellow name, meaning the version what you would see on the GitHub page would be quite outdated. |
So what is the consensus for this PR? |
I still need to test the changes and I haven't had time because FlxWeapon is pretty low on my list of priorities. My opinion of FlxWeapon is that it probably shouldn't exist and some new standalone tool should be made from the ground up, however I don't want to remove it until the next major version release, which isn't any time soon so I'm allowing this change if it doesn't have any problems. |
I finally tested this. Lot of issues.
Here's in my example, so far: var weapon:FlxWeapon;
var gun:FlxSprite;
override function create()
{
super.create();
add(gun = new FlxSprite(100, 100, "assets/images/haxe.png"));
weapon = new FlxWeapon
("test", (w)->new FlxBullet()
, PARENT
( gun
, new FlxBounds(FlxPoint.get(0, 0), FlxPoint.get(gun.frameWidth, gun.frameHeight))
, true
)
, SPEED(new FlxBounds(5.0, 10.0))
);
} I get the sense these changes weren't tested, the error happens because Truthfully, after have a taste of FlxWeapon I leaning towards retiring this feature. I think it's poorly executed and never have been in flixel to begin with. I also hate FlxBounds and want to remove all references to that. I'm even considering removing the tool in the next major version, I would create a new repo called LegacyFlxWeapon that people can use if they have old projects that need it, either that or just deprecate the entire class or put a huge disclaimer on it to prevent people from creating issues or PRs to this. It's just too niche, and it's not worth my time compared to just about any other flixel feature I think you can make a far better weapon/bullet manager than this, and you absolutely should, and we'll add it to the external tools list. |
If i were to try and save this class, I would do something like this, but I still think the class is trash and should just be rewritten in a new repo |
That's fair. Why do you dislike |
Its mainly used to define rects via literals but FlxRect would allow that more compactly. FlxRect has more features than FlxBounds, too. this is basically the only thing that uses it |
Clarified the outdated doc comments, removed unused fields, and changed how
fireRate
is implemented to make it more accurate to the game's time (because the old implementation didn't properly respect the game pausing when tabbed out). Also madeFlxWeapon
destroyable.If this gets approved, I would also like to know whether I should destroy the
FlxSounds
or simply set them tonull
. Regardless of whichever one is picked, I'll still be making a commit to remove that TODO comment in thedestroy()
function.