Skip to content

Instantly share code, notes, and snippets.

View KinoAR's full-sized avatar
🏠
Working from home

Kino KinoAR

🏠
Working from home
View GitHub Profile
@KinoAR
KinoAR / InvincibilityDemo.hx
Last active March 17, 2021 22:04
Haxe Flixel invincibility demo on a player character.
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 March 6, 2021 22:03
An example of a pause menu in HaxeFlixel. Note this won't just work in your game as it contains custom code.
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 March 6, 2021 21:54
New scene in HaxeFlixel created using PlayState as an example.
/**
* 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 February 28, 2021 21:41
An example of creating a main entry point in Haxe in 4.2
//Module Level Main entry point in Haxe 4.2.0
function main() {
trace('Hello World');
}
@KinoAR
KinoAR / Main-Old.hx
Created February 28, 2021 21:39
Old way of creating a main entry point in Haxe
//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 February 21, 2021 01:47
State machine in HaxeFlixel
package game;
class State {
public var currentState:Float -> Void;
public function new(initialState:Float -> Void) {
currentState = initialState;
}
@KinoAR
KinoAR / Flixel-Automatic-build.yaml
Last active February 11, 2021 02:30
Automatic Build File
# 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:
@KinoAR
KinoAR / cutscene-update.hx
Created January 30, 2021 00:09
Update logic for the cutscene example in HaxeFlixel
/**
* Update Code - HaxeFlixel
* Kino Rose
*/
class CutsceneState extends FlxState {
//Code from Before
override public function update(elapsed:Float) {
@KinoAR
KinoAR / cutscene-create.hx
Created January 29, 2021 23:52
Create function for Cutscene
class CutsceneState extends FlxState {
//Additional code from before here
public static inline var TEXT_WIDTH:Int = 400
override public function create() {
createSkip();
createSceneText();
@KinoAR
KinoAR / cutscene-state.hx
Last active January 29, 2021 23:37
Setup for the cutscene-state
package;
//Imports for the FlxState
import flixel.addons.text.FlxTypeText;
import flixel.text.FlxText;
import flixel.FlxState;
// Type Information to create a delay that you want for each individual text that appears on screen
typedef SceneText = {
public var text:String;