Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Kino KinoAR

🏠
Working from home
View GitHub Profile
@KinoAR
KinoAR / DepotMacros.hx
Last active Mar 29, 2021
Macro for Depot that turns your database elements/spreadsheet rows into a part of your code base.
View DepotMacros.hx
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;
@KinoAR
KinoAR / BuildMacroExample.hx
Created Mar 29, 2021
Build Macro Example in HaxeFlixel
View BuildMacroExample.hx
package;
// Path to your own depot file
@:build(macros.DepotMacros.buildDepotFile('assets/data/database.dpo'))
class DepotData {}
@KinoAR
KinoAR / CollisionDetection.hx
Last active Mar 26, 2021
HaxeFlixel collision detection with groups example.
View CollisionDetection.hx
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>;
@KinoAR
KinoAR / InvincibilityDemo.hx
Last active Mar 17, 2021
Haxe Flixel invincibility demo on a player character.
View InvincibilityDemo.hx
import flixel.util.FlxColor;
import flixel.FlxSprite;
class Player extends FlxSprite {
// Whether the player is invicible or not
public var isInvincible:Bool;
//The amount of time to be invincible for in seconds
public static inline var INVINCIBLE_TIME:Float = 1.5;
@KinoAR
KinoAR / PauseSubState.hx
Created Mar 6, 2021
An example of a pause menu in HaxeFlixel. Note this won't just work in your game as it contains custom code.
View PauseSubState.hx
package game.states;
import game.ui.TextButton;
/*
* Custom Pause Scene I made for my game.
*/
class PauseSubState extends FlxSubState {
public var pauseText:FlxText;
private var pauseExitSound:FlxSound;
@KinoAR
KinoAR / PlayState.hx
Created Mar 6, 2021
New scene in HaxeFlixel created using PlayState as an example.
View PlayState.hx
/**
* Basic example of a scene used in the tutorial for HaxeFlixel as well.
*/
class PlayState extends FlxState {
override public function create() {
super.create();
add(new FlxText('Hello World', 32).screenCenter());
}
override public function update(elapsed:Float) {
super.update(elapsed);
@KinoAR
KinoAR / Main-New.hx
Created Feb 28, 2021
An example of creating a main entry point in Haxe in 4.2
View Main-New.hx
//Module Level Main entry point in Haxe 4.2.0
function main() {
trace('Hello World');
}
@KinoAR
KinoAR / Main-Old.hx
Created Feb 28, 2021
Old way of creating a main entry point in Haxe
View Main-Old.hx
//Example of a main entry point in Haxe before 4.2
class Main {
public static function main() {
trace('Hello World');
}
}
@KinoAR
KinoAR / State.hx
Created Feb 21, 2021
State machine in HaxeFlixel
View State.hx
package game;
class State {
public var currentState:Float -> Void;
public function new(initialState:Float -> Void) {
currentState = initialState;
}
View Flixel-Automatic-build.yaml
# This is a basic workflow to help you get started with Actions
name: Build Game
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request: