-
Notifications
You must be signed in to change notification settings - Fork 450
Flixel 5.0.0 Migration guide
Flixel 5.0.0 is the first major update to flixel since 2016. Since then, we've added many new features without messing up existing games but if you want to make a great game engine, you need to make a few breaking changes. In order to keep major version updates to a minimum, we ended up stock-piling a large list of fixes and features. This guide will help you utilize them in your existing Flixel 4 games.
- If you're project is using an older version than 4.11, it might be a good idea to try 4.11 before 5.0
- [Talk about the beta, if we end up having a beta]
- Be sure to check out the changelog for a quick overview of every change that was made
The old default args for FlxG.save.bind
were ("flixel", null)
where null would be replaced with the full url or file path to the application. This created issues where releasing updates could create a new save path. The new args are generated from your Project.xml's file
and company
metadata, respectively. Game's will automatically look for the legacy save file, and migrate the data over to the new save if it exists.
You can also specify your own desired save path for FlxG.save
, just call FlxG.save.bind("mySaveName", "mySavePath");
before instantiating your FlxGame
and it will be used by flixel, internally, to save and load sound, window and debug preferences. Previously the default save would overwrite this value when the FlxGame is initialized
Collisions Preserve Momentum #2422
Collisions with FlxG.collide
between objects of different masses used to flip out and act strangely, this is now corrected. This is still a breaking change, however, and anyone depending on the old system should be aware. For instance, any game using FlxReplay
to replay player runs with collisions using objects of different mass or elasticity will have invalid replays on the new system. To keep the Flixel 4.0 collision physics on a Flixel 5.0 game you can use the compiler constant FLX_4_LEGACY_COLLISION
.
Angles at 0˚ Point Right, Not Up #2482
There used to be some inconsistencies regarding angles, almost every math utility would point right at 0 degrees, but not everywhere. Notably FlxSwipe
and FlxPath
treated 0 degrees as up. If you're using a FlxPath
on a sprite with autoRotate
enabled, you'll need to change your sprite to face right at 0 degrees. (actually wait, I should make an offset property to solve this more easily)
FlxVector is Dead, All Hail FlxPoint #2557
It seemed silly to have 2 separate 2d position classes, so we took every method in FlxVector
and moved them all to FlxPoint
. FlxVector
Still exists, but it's been reduced to a deprecated typedef of FlxPoint
. Not many devs knew FlxVector existed, so hopefully this will expose more devs to cool features like length
and degrees
getter/setters, or math helpers like dotProduct
and bounceWithFriction
.
As a bonus, we've also added math operators, like +
, +=
, -
, -=
, *
and *=
.