Skip to content

Instantly share code, notes, and snippets.

View NoelFB's full-sized avatar

Noel Berry NoelFB

View GitHub Profile
@NoelFB
NoelFB / gist:900007
Created April 2, 2011 23:28
Movement Code
// move
lastPosition = position;
position += velocity * Monocle::deltaTime;
CollisionData col;
if(Collide("Solid", &col))
{
// move to last position
// 64 is the radius of the player collider
position.y = col.hitPoint.y + (col.normal.y * 64);
// render light circles
for (i = 0; i < lights.length; i ++)
{
l = lights[i];
var isSet:Object = new Object();
for (j = 0; j < l.distance * 2; j++)
{
isSet[j] = new Object();
@NoelFB
NoelFB / TerrainEditor.cs
Last active January 22, 2021 02:13
Terrain Thingy
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(TerrainManager))]
public class TerrainEditor : Editor
{
private TerrainManager terrain { get { return (TerrainManager)target; } }
private Vector2Int? selected;
@NoelFB
NoelFB / Tile3D.cs
Last active November 2, 2021 16:24
3D Tile editor thing
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
[RequireComponent(typeof(MeshCollider))]
[ExecuteInEditMode]
public class Tile3D : MonoBehaviour
@NoelFB
NoelFB / index.js
Created June 4, 2018 23:42
Javascript HTML template engine that just... runs JS in a vm
let data = {
title: "All My Posts",
posts: [
{ title: "first post", body: "nothing to see here" },
{ title: "second post", author: { name: "Somebody" }, body: "another post, wow" },
{ title: "final post", body: "this is the end" }
]
};
let fs = require("fs");
@NoelFB
NoelFB / Aseprite.cs
Last active May 10, 2024 01:44
ugly C# .ase (aseprite) parser
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
// File Format:
// https://github.com/aseprite/aseprite/blob/master/docs/ase-file-specs.md
// Note: I didn't test with with Indexed or Grayscale colors
@NoelFB
NoelFB / aseprite-guid.lua
Created April 22, 2020 17:11
creating unique GUIDs for Aseprite files
-- This creates proper GUIDs for Aseprite files so the game can load them.
-- To Use:
-- 1) Open Aseprite and go to File -> Scripts -> Open Scripts Folder and place this file there
-- 2) Restart Aseprite
-- 3) Run this script when you save an Aseprite file and it will automatically create
-- GUIDs for the sprite along with every slice
-- More Info: https://www.aseprite.org/docs/scripting/
@NoelFB
NoelFB / routine.h
Last active November 7, 2022 07:19
Simple C++ Coroutine using a switch statement internally
#pragma once
namespace YourNamespace
{
struct Routine
{
// Current "waiting time" before we run the next block
float wait_for = 0;
// Used during `rt_for`, which repeats the given block for X time
#include <blah.h>
#include "imgui/imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui/imgui_internal.h"
using namespace Blah;
namespace
{
MeshRef mesh;
@NoelFB
NoelFB / Gui.cs
Created September 18, 2023 04:36
Foster ImGuiNET Wrapper
using System.Diagnostics;
using System.Numerics;
using Foster.Framework;
using ImGuiNET;
public static class Gui
{
private static readonly VertexFormat VertexFormat;
private static IntPtr context;
private static bool beginCalled = false;