Skip to content

Instantly share code, notes, and snippets.

View erodozer's full-sized avatar
🚧
I may be slow to respond between 8am-8pm EST M-F

Nicholas Hydock / ero erodozer

🚧
I may be slow to respond between 8am-8pm EST M-F
View GitHub Profile
@erodozer
erodozer / REDUX_CLASS_REDUCER
Last active August 18, 2017 02:05
OOP Redux
Simple function created so you can make reducers that are classes in ES6.
I did this because I found the switch-statement approach to be rather messy
once the action handling within the reducer gets substantially large.
@erodozer
erodozer / ECS.cs
Created December 10, 2017 03:24
Single file Simple C# Entity-Component-System inspired by Artemis/Ashley
using System;
using System.Collections.Generic;
/// <summary>
/// Very simple entity-component system
/// Provides just the basics, doesn't need to be very efficient because it's
/// most valuable for smaller games without a shit ton of entities
/// </summary>
namespace github.io.nhydock.ECS
{
@erodozer
erodozer / RoguelikeTile.cs
Created December 20, 2017 03:41
Roguelike tile
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Adventure.Tilemaps
@erodozer
erodozer / RedirectInput.cs
Last active December 20, 2017 04:17
Redirect Unity3D input into a letterboxed fixed area. Good for fixed resolution games with aspect ratio preserved scaling.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class RedirectInput : StandaloneInputModule {
// letterboxed fixed area
[SerializeField] Vector2 fixedResolution;
@erodozer
erodozer / consul_sanic_example.py
Last active February 27, 2018 20:07
Sanic Config loading with Consul
from sanic import Sanic
from consul.aio import Consul
import default_settings
import asyncio
"""
Initialize application
"""
@erodozer
erodozer / SceneManager.gd
Last active September 27, 2018 01:59
Godot Scene Transition
extends Node
var next_scene = null
var is_ready setget _finish_transition
onready var anim = $Fader/AnimationPlayer
func _finish_transition(value):
if value:
is_ready = true

Godot Scene Manager

Simple scene manager with simple transition effects using RPG Maker greyscale images. Doesn't do async loading at all, but that's fine for small games that just want a little pizzaz to their visuals. Just drop the file into your project and add it to your Autoloads. Then start doing SceneManager.change_scene('res://myscene.tscn') instead of get_tree().change_scene('res://myscene.tscn') and you'll be good to go.

@erodozer
erodozer / clamp.shader
Created September 27, 2018 01:43
Transition Clamping Shader
shader_type canvas_item;
render_mode blend_mix;
uniform float transition: hint_range(0, 1);
float val(vec3 color) {
return max(max(color.r, color.g), color.b);
}
void fragment() {
@erodozer
erodozer / SceneManager.gd
Last active July 12, 2019 01:01
Improved SceneManager
extends Node
onready var anim = $Fader/AnimationPlayer
func change_scene(next_scene, params=[]):
"""
Changes scene with a transition.
You can hold the fade back in transition if desired until
the next scene is in a state that is considered ready
"""
@erodozer
erodozer / example_npc.gd
Created March 11, 2019 03:19
example_npc script
extends "res://maps/NPC.gd"
func interact():
dialog.prepare()
dialog.show()
if GameState.Flags.get('talked_to_guilford'):
dialog.line(
"""
#Guilford
Don't worry, I'll have your equipment ready for ya soon. Lemme just finish this drink.