Features of the new version of the game framework Flixel 2.5

Original author: Flixel Community
  • Transfer
Not so long ago, a new version of Flixel , a fairly well-known and popular framework for creating games, was released (the latest changes on github are dated April 28). Now the serial number of the framework has reached the number 2.5. This update includes several, in my opinion, interesting features that can simplify the life of Flash developers even more. If you are interested in Flixel, I strongly recommend that you familiarize yourself with the original description , which contains a number of examples demonstrating new features, which will be discussed below.

Cameras

One of the new features of Flixel is the emergence of a flexible and powerful class for controlling cameras, which is called ( SUDDENLY! ) FlxCamera . By default, a new project is created with one camera, the dimensions of which coincide with the dimensions of the FlashPlayer window. Access to this camera can be obtained through the FlxG.camera link . You can replace this camera or add additional cameras to create effects such as split-screen, picture-in-picture, or minimap. Each camera is an independent visual object, with its own settings for zoom, hue, rotation and scaling. Each game object also has its own list of cameras.therefore, you can simply configure certain game objects to display in certain cameras. Adventure-style game developers can also read the source code for the Mode game to learn more ways to use cameras in games.

Search for a way

The term “ finding a way ” means finding answers to the questions “How to get from point A to point B?” Or “Is it possible to get from point A to point B?”. In class FlxTilemap a new feature FlxTilemap.findPath () , which returns an object FlxPath , which is a list of "nodes" (objects FlxPoint ). Think of this list as simply a list of X and Y coordinates in space that begin at the start position and end at the finish position. When you find a valid path, you can pass this data to any FlxObject using the FlxObject.followPath () function. This function “tells” objects to start following a given path. You can adjust the speed, direction (reverse, yoyo, etc.), and also set the ability to "follow" the path only horizontally (convenient for objects that respond to gravity). These settings allow you to use paths not only for organizing AI characters, but also for organizing elevators, moving platforms, and looping background animations.

Repetitions

Replays is a new and powerful Flixel feature. "Repeats" is a list with information about the pressed keyboard buttons and data on the behavior of the mouse, in accordance with the time. Since Flixel to a greater extent delimits the functionality of its components, we can use the information "repeats" to recreate the game sessions that were recorded by someone else. "Replays" can be used for debugging, creating "attract-mode" modes, in-game demo modes, as well as creating clips. Repeats can be controlled through the VCR panel in the debug layer, or directly through functions such as FlxG.loadReplay () , FlxG.recordReplay () , and FlxG.reloadReplay () . Adventure game developers can alsofamiliarize yourself with the source code of the game “Mode” to see examples of downloading “replays” from a file to create an “attract mode” mode.

Groups and clashes

Flixel game objects can be “saved” inside FlxGroup objects. Groups can be used to simplify, automate and organize updating, rendering, collision search, camera monitoring, scrolling magnitude calculation and much more. When you want to avoid calling resource-intensive functions like FlxG.collide ()more than a few times in each “game cycle”, you can use nested groups as a way to simplify these challenges. For example, the objects in your game are divided into 3 different groups: Apples, Pears and Bananas. And you also want to organize the functionality of “landing” objects. To implement this functionality, it might seem like a good solution to call the FlxG.collide () function 3 times: FlxG.collide (Apples, ground), FlxG.collide (Pears, ground), FlxG.collide (Bananas, ground). A better solution would be to create a 4th group, let's say it will be called Fruit, and add 3 groups of objects (Apples, Pears, Bananas) to this group, and then you can call the FlxG.collide (Fruit, ground) function. In this case, you will retain the functionality of “landing” game objects, as well as get a significant performance boost.

Tilemaps and Auto-Tiling

Inspired by old video games in which the game environment was created from a grid of square " tiles ", Flixel developers created the FlxTilemap class . Each grid cell has a number or index, with which you can refer to a certain part of the graphic, which in turn can be used several times to create a game space. Tile graphics have many advantages, for example, it is easy to understand how tiles should be displayed, how tiles should overlap objects, and what special properties each tile should have. Flixel also provides algorithms for automatically placing wall and floor tiles based on arrays with binary tile information. It is a simple and flexible system that is well suited for rapid prototyping.

Particles

The concepts of “particles” and “particle emitters” refer to individual classes that are used to create special effects and behavior. "Emitters" are objects that create particles and control them. FlxParticle is a simple extension of the FlxSprite class , and FlxEmitter is just an extension of FlxGroup , so the particle systems in Flixel are not much different from other ordinary sprite groups. Particle systems simply add functionality to create and run"Particles, and particles have some properties to customize their behavior so that it looks more realistic. The FlxEmitter class also has some properties for adjusting the “spread” of speeds, rotation speed, gravity, behavior in collisions, etc.

Save game

Flash technology provides an easy way to save information locally, and FlxSave objects provide an interface for working with data storage. This save method is not suitable for all tasks. For example, if you want to create an online high score table, this method will not allow you to do this. If you want players to be able to move and trade game save files, then in this case, using this save method is also not a good idea. FlxSave is well-suited for quickly and easily saving local data such as game progress or user settings.

PS:

Initially, I learned about Flixel leaving the post on flashgameblogs.ru .

Also popular now: