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 flixel.util.FlxSignal; | |
// for signals that don't need data, use FlxSignal | |
var signal = new FlxSignal(); | |
// for signals that need data, use FlxTypedSignal with the correct function type | |
var stringSignal = new FlxTypedSignal<String->Void>(); | |
function noParamCallback() { | |
trace('Dispatched void event'); | |
} |
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
enum Direction { | |
Left; | |
Right; | |
Up; | |
Down; | |
} | |
function main() { | |
currentDirection(Left); | |
currentDirection(Right); |
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 haxe.Rest; | |
function main() { | |
var result = pipe('A', | |
(val:String) -> val.toUpperCase(), | |
(val2:String) -> val2 += " " + "World"); | |
trace(result); //A World | |
} |
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 haxe.Rest; | |
function main() { | |
trace(sum(1, 2, 3)); | |
trace(sum('Hello', ' World')); | |
} | |
function sum(...rest:Dynamic) { | |
var result = null; | |
for(element in rest) { |
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; | |
//Expose metatag is used to make sure that when the code is being referenced in the target language it'll be exposed | |
//for user's to override. I use this in JS to allow for modification, which is core to RPGMakerMV/MZ. | |
//Native metatag is used to make sure that when the code is compiled it uses the proper name. | |
//Native works both on classes and fields, which you can see for the x, y fields below. | |
@:expose("Point") | |
@:native("Point") | |
extern class Point extends pixi.core.math.Point { | |
/** |
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 flixel.util.FlxPath; | |
import flixel.FlxG; | |
import flixel.FlxSprite; | |
import flixel.util.FlxColor; | |
class Player extends FlxSprite { | |
public var walkPath:Array<FlxPoint>; | |
public function new(x:Float, y:Float) { | |
super(x, 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 flixel.FlxState; | |
import flixel.group.FlxGroup; | |
import flixel.FlxSprite; | |
import flixel.util.FlxColor; | |
class PlayState extends FlxState { | |
//bullet group for holding player bullets | |
public var playerBulletGrp:FlxTypedGroup<FlxSprite>; | |
public static inline var PLAYER_BULLET_CAP:Int = 20; | |
override public function create() { |
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 macros; | |
#if macro | |
import haxe.DynamicAccess; | |
import Types.DepotFile; | |
import sys.io.File; | |
import sys.FileSystem; | |
import haxe.macro.Expr.Field; | |
import haxe.Json; | |
import haxe.macro.Context; |
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; | |
// Path to your own depot file | |
@:build(macros.DepotMacros.buildDepotFile('assets/data/database.dpo')) | |
class DepotData {} |
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 flixel.FlxState; | |
import flixel.group.FlxGroup; | |
import flixel.FlxSprite; | |
import flixel.FlxG; | |
import flixel.util.FlxColor; | |
class PlayState extends FlxState { | |
//Creating the player, enemies, and npc group. | |
public var npcs:FlxTypedGroup<FlxSprite>; | |
public var enemies:FlxTypedGroup<FlxSprite>; |