This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import flixel.FlxCamera; | |
import flixel.FlxG; | |
import flixel.FlxSprite; | |
import flixel.math.FlxRect; | |
/** | |
* ... | |
* @author Zaphod | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tileWidth:Int = 32; | |
var tileHeight:Int = 32; | |
var tileSize:FlxPoint = new FlxPoint(tileWidth, tileHeight); | |
var tileSpacing:FlxPoint = new FlxPoint(2, 2); // we need to add spacing between tile images | |
var tileBorder:FlxPoint = new FlxPoint(2, 2); // and add borders around tiles (copy some pixels around tile images) | |
var tileFrames:FlxTileFrames = FlxTileFrames.fromBitmapAddSpacesAndBorders("your/tileset/image", tileSize, tileSpacing, tileBorder); // this method just takes original image, creates new one and generates required collection of frames, which can be loaded in tilemap or sprite | |
tilemap.loadMapFromCSV(mapData, tileFrames); // all tilemap loading methods can take tile frames collection as a source of graphics for them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This method takes array of tileset bitmaps and the size of tiles in them and then combine then in one big tileset. | |
* The order of bitmaps in array is important. | |
* | |
* @param bitmaps tilesets | |
* @param tileSize the size of tiles (tilesets should have tiles of the same size) | |
* @return atlas frames collection, which you can load in tilemaps or sprites: | |
* | |
* var combinedFrames = combineTiles(bitmaps, new FlxPoint(16, 16)); | |
* tilemap.loadMapFromCSV(mapData, combinedFrames); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef FlxGraphicAsset = AcceptOneOfFive<String, Class<Dynamic>, CachedGraphics, TextureRegion, BitmapData>; | |
abstract AcceptOneOfFive<T1, T2, T3, T4, T5>(EitherOfFive<T1, T2, T3, T4, T5>) | |
{ | |
public inline function new(e:EitherOfFive<T1, T2, T3, T4, T5>) | |
{ | |
this = e; | |
} | |
public var value(get, never):Dynamic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_point.x = x; | |
_point.y = y; | |
var csx:Float = 1; | |
var ssy:Float = 0; | |
var ssx:Float = 0; | |
var csy:Float = 1; | |
var x1:Float = (_origin.x - frame.center.x) * scale.x; | |
var y1:Float = (_origin.y - frame.center.y) * scale.y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flash.Lib; | |
import flash.display.Sprite; | |
import flash.display.Bitmap; | |
import flash.display.BitmapData; | |
import openfl.Assets; | |
import openfl.display.Tilesheet; | |
import flash.display.Graphics; | |
import flash.events.Event; | |
class Particle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ; | |
import org.flixel.FlxG; | |
import org.flixel.plugin.pxText.PxBitmapFont; | |
import nme.display.BitmapData; | |
import nme.geom.Rectangle; | |
class BitmapFont extends PxBitmapFont | |
{ | |
private var glyphWidth:Int; |
NewerOlder