Skip to content

Instantly share code, notes, and snippets.

View lewislepton's full-sized avatar
🏳️‍🌈
tofu bouncing bonanza

Lewis Lepton lewislepton

🏳️‍🌈
tofu bouncing bonanza
View GitHub Profile
@AustinEast
AustinEast / Outline.hx
Last active January 2, 2023 09:41
HaxeFlixel Pixel-Perfect Outline Shader
import flixel.system.FlxAssets.FlxShader;
import flixel.util.FlxColor;
class Outline extends FlxShader
{
@:glFragmentSource('
#pragma header
uniform vec2 size;
uniform vec4 color;
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
// note : I found (visually) that there is a little mistake in this rotation version but I haven't found where in the code
// edit : I think I understood the mistake but it's quite annoying to fix :)
int[][] result;
float t, c;
@01010111
01010111 / OgmoExample.hx
Created June 11, 2019 16:05
Example of using OgmoUtils class
using OgmoUtils;
class OgmoExample
{
public function new(level_json:String)
{
var data = level_json.parse_level_json();
var tile_layer = data.get_tile_layer('tiles');
trace(tile_layer.data2D);
@aks84
aks84 / hamburgermenu.html
Created May 4, 2019 10:01
Create Hamburger Menu with HTML, CSS, and JavaScript
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Hamburger Menu - HTML, CSS, & JS</title>
<style>
@media (max-width: 768px){
.mainMenu{
@01010111
01010111 / OgmoUtils.hx
Last active May 15, 2022 02:46
Utility class for Ogmo
using haxe.Json;
class OgmoUtils
{
// region PARSING
/**
* Parse OGMO Editor level .json text
* @param json
* @return LevelData
@01010111
01010111 / hello.p8
Last active March 9, 2019 11:46
ECS in P8 ✨
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
--pecs - pico-8 ecs
--01010111
function _init()
local rect = get_id()
add_component(rect, 'position', { x=60, y=60 })
add_component(rect, 'physics', { vx=2, vy=0, ax=0, ay=2, dx=0.9, dy=1.0 })
@Eiyeron
Eiyeron / CustomSound.hx
Last active February 10, 2019 17:03
Haxe/Heaps custom Sound/Data class pair to generate sound on the fly. Beware, it's experimental and prone to crash if you tweak the wrong knobs.
import hxd.snd.Data;
import hxd.res.Sound;
// This class should work like a Sound. Jsut create one and call play and a lo-fi generated tune should ring.
// You can check out a bit more about bytebeat there : http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
class CustomSound extends Sound {
public function new() {
super(null);
data = new SoundDataGenerator();
}

Generating Procedural Game Worlds with Wave Function Collapse

Wave Function Collapse (WFC) by @exutumno is a new algorithm that can generate procedural patterns from a sample image. It's especially exciting for game designers, letting us draw our ideas instead of hand coding them. We'll take a look at the kinds of output WFC can produce and the meaning of the algorithm's parameters. Then we'll walk through setting up WFC in javascript and the Unity game engine.

sprites

The traditional approach to this sort of output is to hand code algorithms that generate features, and combine them to alter your game map. For example you could sprinkle some trees at random coordinates, draw roads with a brownian motion, and add rooms with a Binary Space Partition. This is powerful but time consuming, and your original vision can someti

@Beeblerox
Beeblerox / CRTFilter
Created July 23, 2017 09:34
CRTFilter for OpenFl 5.0
package;
import openfl.Lib;
import openfl.display.Shader;
import openfl.filters.BitmapFilter;
import openfl._internal.renderer.RenderSession;
import openfl.geom.Point;
/**
* ...