FlixelCommunity / flixel

Community fork of Adam “Atomic” Saltsman's popular game engine Flixel. Distilled from a variety of Flash games he worked on over the last couple years, including Gravity Hook, Fathom and Canabalt, its primary function is to provide some useful base classes that you can extend to make your own game objects.
http://flixelcommunity.org/
Other
84 stars 17 forks source link

Add property "position" to FlxSprite #222

Open Dovyski opened 9 years ago

Dovyski commented 9 years ago

There are several elements in FlxObject that have x and y properties, such as velocity, acceleration, drag and maxVelocity to name a few. They are all instances of FlxPoint, which totally makes sense.

The position of a FlxObject, however, is represented by two different Number properties. If they were represented by FlxPoint like everything else, checking the distance between two objetcs or sprites would be as easy as a.position.distance(b.position).

I suggest adding a position:FlxPoint property to FlxObject, turning the current x and y properties into getters/setters.

greysondn commented 9 years ago

I will at least agree that I've found that property odd for some time.

The actual change is fairly simple, all things considered. Are we now 3.0 and okay with breaking API?

Dovyski commented 9 years ago

I was not planning to break the API because the x and y properties would still be there, both internally getting position.x and posision.y.

Version 3.0 will definitely break the API since several classes have been moved into new packages. That's the reason why we bumped the version number from 2.58 to 3.0.

greysondn commented 9 years ago

... Deprecation warnings?

Dovyski commented 9 years ago

Yes, we introduced them for 3.0 to ensure a smoother transition. Take a look at this, for instance.