flixel v4.0.0 Release Notes
Release Date: 2016-02-16 // about 8 years ago-
Restructures:
- 🔄 Changed
static inline
vars to enums: (#998)FlxCamera
follow stylesFlxCamera
shake modesFlxText
border stylesFlxTilemap
auto-tiling optionsFlxBar
fill directionsFlxG.html5
browser types
- 🚚 Moved
FlxMath
,FlxPoint
,FlxVector
,FlxRect
,FlxAngle
,FlxVelocity
andFlxRandom
toflixel.math
- 🚚 Moved "typed" classes: (#1100)
FlxTypedGroup
intoFlxGroup.hx
FlxTypedSpriteGroup
intoFlxSpriteGroup.hx
FlxTypedEmitter
intoFlxEmitter.hx
FlxTypedButton
intoFlxButton.hx
- ⚡️ The signature of
update()
functions was changed toupdate(elapsed:Float)
. Theelapsed
argument should be used instead ofFlxG.elapsed
. (#1188)
Rendering:
- ➕ Added
flixel.FlxStrip
which supports rendering viadrawTriangles()
- Added an experimental rendering method using
drawTriangles()
(enabled by definingFLX_RENDER_TRIANGLE
, requiresFlxG.renderTile
to be true). - The tile renderer now uses
Tilesheet.TILE_RECT
instead ofaddTileRect()
- Renderers are now distinguished by
FlxG.renderMethod
(FlxG.renderBlit
/FlxG.renderTile
for easy access) instead of defines (FLX_RENDER_BLIT
/FLX_RENDER_TILE
). This allows for a fallback to software rendering on certain targets if hardware rendering is not available. (#1668)
flixel.FlxCamera:
- ➕ added
pixelPerfectRender
as a global setting for sprites and tilemaps (#1060) - 0️⃣
pixelPerfectRender
now defaults tofalse
withFlxG.renderTile
(#1065) bounds
->minScrollX
,maxScrollX
,minScrollY
andmaxScrollY
(null
means unbounded) (#1070)setBounds()
->setScrollBoundsRect()
(#1070)- ➕ added
setScrollBounds()
- ➕ added
targetOffset
(#1056) - ➕ added
scrollRect
sprite which crops the camera's view when the camera is scaled - camera now scales from its center, not its top left corner
- ⚡️
followLerp
is now a range taking values from 0 to (60 / FlxG.updateFramerate
) - the closer to zero the more lerp! (#1220) - ➕ added
snapToTarget()
(#1477) - 🛠
fade()
: fixedFadeIn == true
not working in a fade out callback (#1666) - 🚚
follow()
: removed theOffset
argument (#1056)
flixel.FlxG:
- 🛠
debugger
: fixed a crash when callingaddTrackerProfile()
beforetrack()
- 🚦
signals
:- split
gameReset
into pre/post signals - added
preStateCreate
(#1557)
- split
- 0️⃣
android
:preventDefaultBackAction
has been replaced bypreventDefaultKeys
inputs
: addedresetOnStateSwitch
- ➕ added
FlxG.addPostProcess()
/removePostProcess()
- ➕ added
resizeWindow()
- ➕ Added
filtersEnabled
andsetFilters()
toFlxCamera
andFlxGame
(#1635) - 🏗
version
now includes the commit SHA via a build macro
flixel.FlxObject:
- ➕ added
getPosition()
andgetHitbox()
- ⚡️ split some of
separate()
's functionality intoupdateTouchingFlags()
, allowingtouching
to be used without any separate calls (#1555) - ➕ added
path
(#1712)
flixel.FlxSprite:
- ➕ added
graphicLoaded()
getScreenXY()
->getScreenPosition()
- ✂ removed the
NewSprite
argument fromclone()
- ➕ added
clipRect
frames
->numFrames
- ➕ added
frames
which reflects the sprite's current frames collection - ✂ removed
loadGraphicFromTexture()
andloadRotatedGraphicFromTexture()
cachedGraphics
->graphic
- ➕ added
setFrames()
which allows you to save animations which already exists in the sprite colorTransform
is always instantiated- ➕ added
loadRotatedFrame()
which allows you to generate prerotated image from given frame and load it - ➕ added error message then trying to get pixels and graphic is null
drawFrame()
is no longerinline
so it can be redefined in subclasses.set_angle()
: always change the prerotated animation angle to prevent delays- ✂ removed
resetFrameBitmaps()
method, since frames don't store bitmaps anymore. Setdirty
to true to force the frame graphic to be regenerated in the next render loop. - ➕ added
useFramePixels
setColorTransform()
's offset arguments now work with drawTiles rendering on OpenFL 3.6.0+ (#1705)- ⚡️
getFlxFrameBitmapData()
->updateFramePixels()
(#1710)
flixel.FlxState:
onFocus()
andonFocusLost()
no longer requireFlxG.autoPause
to be false- ➕ added
switchTo()
(#1676)
flixel.animation:
FlxAnimation
:- added
reversed
var which allows you to play animation backwards - second argument of
play()
method isReversed
now - added
flipX
andflipY
(#1670)
- added
FlxAnimationController
:curAnim
does also return animations that have finished now- removed
get()
callback
: fixed oldframeIndex
value being passed instead of the current oneadd()
now makes a copy of theFrames
array before callingsplice()
on it- fixed
finished
not being true during the last animation frame in thecallback
- added
Reversed
argument inplay()
method, which allows you to set animation's playback direction
flixel.effects:
FlxEmitter
:at()
->focusOn()
on
->emitting
- emitters and particles now use
FlxColor
instead of separate red, green, and blue values - removed
FlxEmitterExt
,FlxEmitter
now has two launch modes:CIRCLE
(the new default) andSQUARE
(#1174) - removed
xPosition
,yPosition
,life
,bounce
, and various other properties, and property setting convenience functions (see below) (#1174) - a variety of values can now be set with much greater control, via
lifespan.set()
,scale.set()
,velocity.set()
and so on (#1174) - simplified
start()
parameters (#1174) - added
angularDrag
andangularAcceleration
(#1246)
FlxParticle
: (#1174)maxLifespan
->lifespan
,lifespan
->age
, percent indicates(age / lifespan)
age
counts up (as opposed tolifespan
, which counted down)- range properties (
velocityRange
,alphaRange
) which determine particle behavior after launch - "active" flags (
alphaRange.active
,velocityRange.active
, etc) whichFlxEmitter
uses to control particle behavior
flixel.graphics:
FlxGraphic
:- renamed from
CachedGraphics
and moved toflixel.graphics
- added
defaultPersist
(#1241) - added
fromAssetKey()
,fromClass()
andfromBitmapData()
bitmap
is now settable
- renamed from
FlxAtlas
:- moved to
flixel.graphics.atlas
- added
addNodeWithSpacings()
- added
minWidth
,maxWidth
,minHeight
andmaxHeight
(the size starts atmin
and grows up untilmax
as images are added) - added
powerOfTwo
(forces atlas size to a power of two) - added
allowRotation
(indicates whether added images may be rotated to save space)
- moved to
FlxNode
:- moved to
flixel.graphics.atlas
- added
getTileFrames()
andgetImageFrame()
- moved to
- Introduced a new frames collections concept replacing regions:
- added
FlxImageFrame
frames collection which contains single frame - added
FlxTileFrames
frames collection which contains frames for spritesheet, which can be generated from image region or frame (including rotated and trimmed frames) - added
FlxAtlasFrames
frames collection instead of various texture atlas loaders (likeSparrowData
andTexturePackerData
). It contains various static methods for parsing atlas files - added
FlxFilterFrames
frames collection instead ofFlxSpriteFilter
(see filters demo)
- added
- 👍 Rewrote
PxBitmapFont
and renamed it toFlxBitmapFont
. It supports AngelCode, XNA and Monospace bitmap fonts now. FlxFrame
:- doesn't store the frame's bitmapatas anymore, so
getBitmap()
and other bitmap methods have been removed - added
paint()
andpaintFlipped()
methods instead. This solution requires much less memory, but will be a bit slower. - added
flipX
andflipY
(#1591)
- doesn't store the frame's bitmapatas anymore, so
flixel.group:
FlxTypedGroup
:FlxTypedSpriteGroup
: addediterator()
flixel.input:
FlxSwipe
:duration
now uses seconds instead of milliseconds (#1272)FlxMouse
andFlxTouch
now extend a new common base classFlxPointer
instead ofFlxPoint
(#1099)- adds
overlaps()
toFlxMouse
- adds
flixel.input.gamepad:
FlxGamepadManager
:- better handling of disconnecting and reconnecting gamepads.
getByID()
can now returnnull
. anyButton()
now has astate
argumentglobalDeadZone
can now be 0globalDeadZone
now overshadows instead of overriding the gamepad's deadzone values
- better handling of disconnecting and reconnecting gamepads.
FlxGamepad
:- refactored gamepads to include mappings, removing the need to write separate logic for each gamepad type (#1502):
- each gamepad now has a
model
,mapping
andname
- moved the ID classes to
flixel.input.gamepad.id
- all IDs are now mapped to a value in
FlxGamepadInputID
- the previous "raw" gamepad IDs are now available via separate functions
- added
pressed
,justPressed
,justReleased
andanalog
- removed the dpad properties, they are now mapped to buttons
- added a
connected
flag - added
deadZoneMode
, circular deadzones are now supported (#1177) anyButton()
now has astate
argument- added support for WiiMote (#1563) and PS Vita (#1714) controllers
flixel.input.keyboard:
FlxKeyboard
:- added
preventDefaultKeys
for HTML5 - added an
abstract
enum for key names (FlxG.keys.anyPressed([A, LEFT])
is now possible) - the any-functions now take an Array of
FlxKey
s instead of Array of Strings (string names are still supported) - removed
FlxKey.NUMPADSLASH
(SLASH
has the same keycode)
- added
flixel.input.mouse:
- 👀
FlxMouseEventManager
:
flixel.math:
FlxAngle
:FlxMath
:bound()
andinBounds()
now acceptnull
as values, meaning "unbounded in that direction" (#1070)wrapValue()
->wrap()
, replaced theamount
argument with a lower bound- changed
MIN_VALUE
andMAX_VALUE
toMIN_VALUE_FLOAT
andMAX_VALUE_FLOAT
, addedMAX_VALUE_INT
(#1148) - added
sinh()
(#1309) - added
fastSin()
andfastCos()
(#1534) - optimized
isEven()
andisOdd()
- added
remapToRange()
(#1633) getDistance()
->FlxPoint#distanceTo()
(#1716)
FlxPoint
:inFlxRect()
->inRect
FlxRandom
:FlxRandom
functions are now member functions, callFlxG.random
instead ofFlxRandom
(#1201)- exposed
currentSeed
as an external representation ofinternalSeed
(#1138) - removed
intRanged()
andfloatRanged()
,int()
andfloat()
now provide optional ranges (#1138) - removed
weightedGetObject()
,getObject()
now has an optionalweights
parameter (#1148) - removed
colorExt()
, try usingFlxColor
to get finer control over randomly-generated colors (#1158) - updated random number generation equation to avoid inconsistent results across platforms; may break recordings made in 3.x! (#1148)
- can now create an instance of
FlxRandom
to create deterministic pseudorandom numbers independently of HaxeFlixel core functions (e.g. particle emitters) chanceRoll()
->bool()
- added
floatNormal()
(#1251)
FlxRect
:- added
weak()
,putWeak()
,ceil()
andfloor()
containsFlxPoint()
->containsPoint()
- added
FlxVelocity
:accelerateTowards*()
-functions now only take a singlemaxSpeed
argument (instead ofx
andy
)
flixel.system:
- 🍱
FlxAssets
:cacheSounds()
->FlxG.sound.cacheAll()
(#1097)- OpenFL live asset reloading is now supported (native targets)
FlxSound
flixel.system.debug:
Console
:- refactored the console to be powered by hscript (#1637)
- added auto-completion
- fixed focus on native targets
flixel.system.scaleModes:
BaseScaleMode
: addedhorizontalAlign
andverticalAlign
RatioScaleMode#new()
: added afillScreen
option- The
FlxCamera
sprite is now scaled (instead ofFlxGame
)
flixel.text:
- Rewrote
FlxBitmapTextField
and renamed it toFlxBitmapText
FlxText
:- added an
abstract
enum for alignment (text.alignment = CENTER;
is now possible) font
now supports font assets not embedded viaopenfl.Assets
(i.e.@:font
)font = null;
now resets it to the default font- fixed an issue where the value returned by
get_font()
wouldn't be the same as the one passed intoset_font()
- added
applyMarkup()
(#1229) - fixed issues with
borderStyle
andFlxTextFormat
on native - added
stampOnAtlas()
method, which stamps text graphic on provided atlas and loads result node's graphic into this text object - retrieving text dimensions (
width
andheight
) can now trigger text graphic regeneration (if any changes led to a dimensions change) to report the correct values borderColor
now supports alpha values / ARBG colors- fixed
setFormat()
resettingalignment
(#1629)
- added an
- 🚚 Moved
FlxTextField
to flixel-addons
flixel.tile:
FlxBaseTilemap
: addedsetRect()
method which allows you to set a rectangular region of tiles to the provided indexFlxTile
: addedframe
variable which holds tile's "graphic"FlxTileblock
:- added
setTile()
andtileSprite
(#1300) - added
loadFrames()
method which allows you to use frames collection as a source of graphic
- added
FlxTilemap
:- separated rendering and logic, adding
FlxBaseTilemap
(#1101) - added
getTileIndexByCoords()
andgetTileCoordsByIndex()
- fixed a bug in
overlapsAt()
loadMap()
now treats tile indices with negative values in the map data as 0 (#1166)- added
blend
,alpha
andcolor
- added
frames
property, so you can change tilemap's graphic without reloading map loadMap()
acceptsFlxGraphic
,String
,FlxTileFrames
orBitmapData
asTileGraphic
nowloadMap()
has been split intoloadMapFromCSV()
andloadMapFromArray()
(#1292)- added
loadMapFrom2DArray()
(#1292) - added
offset
property (#1444) allowCollisions
now sets theallowCollisions
property of each tile- fixed
ray()
not detecting a collision with perfectly diagonal start and end points (#1617) findPath()
: replacedWideDiagonal
argument withDiagonalPolicy
(#1659)
- separated rendering and logic, adding
flixel.tweens:
FlxTween
complete
callback parameter in options is now calledonComplete
. Its type,CompleteCallback
, is now calledTweenCallback
. (#1273)- added
onStart
andonUpdate
callback parameters in options (#1273) - fixed
active = false;
not doing anything duringonComplete()
ofLOOPING
orPINGPONG
tweens - angle tween sets sprite's angle on start now
- added
then()
andwait()
for chaining (#1614) - made
start()
public (#1692) active
is now only true when in progress
- Motion tweens:
- the original
FlxObject#immovable
value is now restored after completion
- the original
💻 flixel.ui:
FlxAnalog
andFlxVirtualPad
now have their own atlas to reduce draw callsFlxTypedButton
:- now implements
IFlxInput
, addingpressed
,justPressed
,released
andjustReleased
- now uses animations for statuses instead of setting
frameIndex
directly for more flexibility (removesallowHighlightOnMobile
, addsstatusAnimations
) - disabling the highlight frame is now tied to
#if FLX_NO_MOUSE
instead of#if mobile
labelAlphas[FlxButton.HIGHLIGHT]
is now 1 forFLX_NO_MOUSE
set_label()
now updates the label position- added
maxInputMovement
- added
mouseButtons
to control which mouse buttons can trigger the button label
is no longer initialized if the text passed tonew()
isnull
- added
stampOnAtlas()
for draw call optimization
- now implements
- ➕ Added
FlxSpriteButton
flixel.util:
FlxArrayUtil
:- removed
indexOf()
- moved randomness-related to
FlxRandom
(#1138)
- removed
FlxBitmapDataUtil
:- renamed from
FlxBitmapUtil
(#1118) - added
replaceColor()
(used byFlxSprite#replaceColor()
) - added
addSpacing()
- added
generateRotations()
- renamed from
FlxColor
:FlxPath
:- the original
FlxObject#immovable
value is now restored after completion active
is now only true when in progress- fixed velocity being set even if the object position matches the current node
- exposed
nodeIndex
as a read-only property - removed the
Object
argument fromstart()
, now the path has to be assigned toFlxObject#path
(#1712)
- the original
FlxPool
:- improved pooling performance (#1189)
- 🚦
FlxSignal
:- fixed a bug that occurred when calling
remove()
during a dispatch (#1420)
- fixed a bug that occurred when calling
FlxSpriteUtil
:drawLine()
: default settings forlineStyle
are now thickness 1 and color whitefadeIn()
andfadeOut()
now tweenalpha
instead ofcolor
- added
drawCurve()
(#1263) - removed
FillStyle
, the same functionality is now covered byFillColor
- moved
screenCenter()
toFlxObject
and changed the the arguments from two booleans to theFlxAxes
enum (#1541)
FlxTimer
:complete
->onComplete
(#1275)active
is now only true when in progress
Other:
- ➕ Added an initialization macro that aborts compilation with helpful errors when:
- targeting older SWF versions with invalid defines
- using an unsupported Haxe version
- 🍱 Flixel sound assets are now being embedded via
embed="true"
- 🔄 Changed