You are pretty much correct.
var pt:FlxPoint = new FlxPoint();
This creates a new FlxPoint, without adding it to the 'pool' or setting it as weak. A 'weak' FlxPoint is one that will be destroyed after being passed to a standard haxeflixel method. Again, calling new makes it not weak, and not in a pool.
As you said, it is useful for more permanent FlxPoints, such as storing where the level begins.
var pt:FlxPoint = FlxPoint.weak();
This is identical to calling new FlxPoint
however it also sets the point to be weak. A weak FlxPoint is recycled once it is used in a Haxeflixel function. It is not in a pool by default, however will be added to the pool if .putWeak()
is called. putWeak()
just recycles a temporary (weak) FlxPoint. Although putWeak()
is in the haxeflixel code, you can just as easily call putWeak
if you want to discard a temporary, weak FlxPoint.
This is most useful for points that are used during temporary calculations. You can see it being used in FlxPoint itself, when math is does between two points (such as when they are added).
var pt:FlxPoint = FlxPoint.get();
This method of getting a FlxPoint attempts to retrieve a FlxPoint from the pool of FlxPoints. This is useful because retrieving an existing point from memory and mordifying it is cheaper than creating a new point. You can (and should) return this Point back to the pool by calling .put()
when you are finished with it.
This is most useful for when you will be creating loads of FlxPoint but only using them temporarily. For example, if you need a FlxPoint to show where a bullet will land, and the player is shooting hundreds of bullets, recycling a FlxPoint from a pool is much less expensive than calling new FlxPoint
every bullet.
As you can see, they are all somehow linked, and are very similar.