Flixel-gdx inherits almost all the original features from the original flixel, but flixel-gdx has enhancements. It has a flexible asset manager, it can be developed and deployed on cross-platform and it got amazing performance by using the GPU. Check below for the list of features.
- Display thousands of moving objects
- Basic collisions between objects
- Group objects together for simplicity
- Easily generate and emit particles
- Create game levels using tilemaps
- Text display, save games, scrolling
- Mouse & keyboard input
- Math & color utilities
- Record and play back replays
- Camera system for split screen
- Pathfinding and following
- Easy object recycling
- Cross platform development
- GPU accelerated
- Texture atlas
- Multitouch, sensor, vibration & controller input
- Tween system
- Real physics with Box2D
Show me the features
Write your game with one language and distribute on multiple platforms. With a couple line of code you are able to run your app on a different platform. You only need to extend the required class for specific platform. For example, for the Android platform you extend the class with FlxAndroidApplication and write a launcher and you’re done.
flixel is capable of running more than 1000 moving objects without frame drops. flixel-gdx got GPU support which makes rotation and scaling having less impact on the rendering. flixel is efficient in rendering sprites, it reuses sprites to avoid duplication and it keeps the memory usage low.
Game objects in flixel are can be stored in FlxGroup objects. Groups can be added to the game state to help automate and organize updating, drawing, collisions, camera control, scroll amounts, and more. When you want to avoid calling resource-intensive functions like FlxG.collide() more than a few times in each game loop, you can use nested groups as a way to simplify those calls. For example, let’s say your game objects are divided into three different groups: Apples, Pears, and Bananas. And you want to see if the fruit have landed on the ground yet. You might be tempted to call FlxG.collide() three times: FlxG.collide(Apples, ground); FlxG.collide(Pears,ground); and so on. However, you can create a fourth group, called simply Fruit, and add each of the other groups to it. Then you can just call FlxG.collide(Fruit, ground); and you should see your performance improve notably.
Flixel has a flexible and powerful camera class called (unsurprisingly) FlxCamera. By default, a new flixel game project starts with one camera that is the same size as the application window, which can be referenced at FlxG.camera. You can replace that camera or add additional cameras to create effects like “split screen” views, or “picture in picture” style displays, or even mini-maps. Each camera is an independent display object, with its own zoom, color tint, rotation, and scaling values. Finally, each game object maintains its own camera list, so you can easily instruct certain objects to only display on certain cameras. Adventurous game makers can also check out the more complex Mode source code for more ways to use cameras in-game.
In games, “particles” and “particle emitters” refer to a whole class of behaviors that are usually used for special effects and flavor. The “emitter” is the source and manager of the actual “particle” objects that are spewed out and/or floating around. FlxParticle is just an extension of FlxSprite, and FlxEmitter is just an extension of FlxGroup, so a particle system in flixel isn’t really that different from any normal group of sprites. It just adds some special behavior for creating and launching particles, and the particles themselves have some optional, special behavior to bounce more believably in platformer situations. FlxEmitter also has built-in variables that let you specify velocity ranges, rotation speeds, gravity, collision behaviors, and more.
Pathfinding just means figuring out how to (or if you can) get from A to B. FlxTilemap has a new function FlxTilemap.findPath() which returns a FlxPath object, which is just a collection of “nodes”, or FlxPoint objects. Think of it as a list of (X,Y) coordinates in space, going from the starting location to the ending location. Once you have a valid path, you can pass that data to any FlxObject using FlxObject.followPath(). That function tells the object to start following the path, and you can specify the speed, direction (backward, yoyo, etc), and even tell the object to only follow the path horizontally (handy for objects with gravity applied). These flags mean that you can use paths for more than just character AI – they’re also useful for elevators, moving platforms, and looping background animations.
Replays are a powerful new feature in flixel. Replays are essentially a list of what keyboard keys were pressed, and what mouse inputs were given, during a specific time frame. Because flixel is largely deterministic, we can use that information to recreate a gameplay session that someone else recorded, as long as we have the same SWF. Replays can be used for debugging, arcade-style “attract modes” or in-game demos, and even for cutscenes. Replays can be manipulated using the “VCR” panel on the debugger overlay, or directly through functions like FlxG.loadReplay(), FlxG.recordReplay(), and FlxG.reloadReplay(). Adventurous game makers can also check out the more complex Mode source code to see an example of loading a replay from a file to create an “attract mode”.
Flixel’s FlxTilemap class was inspired by old video games, in which the environment was constructed using a grid of square “tiles”. Each grid cell gets a number, or index, which refers to a particular square graphic. That tile graphic is then placed at the appropriate grid number. Tilemaps have many advantages: it is easy to figure out what tiles should be drawn on screen, what tiles an object overlaps, and what special properties each tile might have. flixel also includes some built-in algorithms for automatically placing wall tiles and floor tiles based on a simple binary (1s and 0s) array of tile data. It is a simple system with a lot of flexibility, which makes it perfect for rapid prototyping.
Flixel comes with a fast physics algorithm which called Quadtree, but flixel-gdx also includes a realistic physics engine Box2D. Box2D engine and let you create more realistic physics games. A Box2D plugin is created and it’s named FlxBox2D. This will make coding with flixel a lot easier. All possible shapes and joints are available and there are bunch of tests where you can learn from it.
Flixel-gdx includes a simple way to save data locally, and the FlxSave object allows you to interface with it. This system is not ideal for all things; for example, if you are doing online high scores, this won’t really work. If you want players to be able to move and trade save game files, this isn’t a good fit either. However, for fast and simple saving of local data, especially things like unlocked progress or user preferences, FlxSave is an easy and built-in option.
Flixel games can be controlled with different inputs. Flixel’s input is independent from the game objects. You only need to call the desire input from the global helper class FlxG. For example checking whether Enter key was just pressed can be done like this FlxG.keys.justPressed(Keys.ENTER). The other inputs like mouse and sensor can aslo be done like the same way. Besides having hardware inputs, flixel also supports multi touch based input, onscreen controller like gamepad and analogstick and hardware controller and gestures.