Skip to content

Instantly share code, notes, and snippets.

@dtgreene
dtgreene / FlyCamera.cs
Created January 3, 2025 21:36
A C# camera flying script for Godot 4.x
using Godot;
public partial class FlyCamera : Camera3D
{
Vector2 mouseMotion = new();
const float MouseMotionFactor = 0.01f;
const float LookSpeed = 12;
const float ModSpeedFactor = 16;
@dtgreene
dtgreene / okta_token.html
Created August 2, 2024 19:18
Okta token decoder
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
* {
box-sizing: border-box;
}
@dtgreene
dtgreene / snake.p8
Last active June 9, 2024 16:01
Snake for the Pico-8
pico-8 cartridge // http://www.pico-8.com
version 42
__lua__
player = {
x = 64,
y = 64,
-- up = 0
-- right = 1
-- down = 2
@dtgreene
dtgreene / dev.txt
Created February 14, 2024 21:00
Game dev asset resources
# Textures
https://ambientcg.com/
https://polyhaven.com/
# Sound effects
https://pixabay.com/
https://freesound.org/
# Everything
https://www.kenney.nl/assets
@dtgreene
dtgreene / screen.gd
Created February 4, 2024 17:57
Fake screen light in Godot
extends Node3D
const data_skip = 5.0
const stream_framerate = 25.0
const stream_width = 2160.0
const stream_height = 3840.0
const stream_ratio = stream_width / stream_height
const energy_boost = 32.0
@onready var screen_light = $ScreenLight
function solveQuadratic(a, b, c) {
return (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a);
}
function distanceTo(x1, y1, x2, y2) {
return Math.hypot(x1 - x2, y1 - y2);
}
function remap(n, start1, stop1, start2, stop2) {
return ((n - start1) / (stop1 - start1)) * (stop2 - start2) + start2;
@dtgreene
dtgreene / TwoDTree.js
Last active March 15, 2023 06:09
A two-dimensional KDTree
class TwoDNode {
constructor(point, axis) {
this.point = point;
this.axis = axis;
this.isActive = true;
this.left = null;
this.right = null;
}
}
console.log('⢀⡴⠑⡄⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀');
console.log('⠸⡇⠀⠿⡀⠀⠀⠀⣀⡴⢿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀');
console.log('⠀⠀⠀⠀⠑⢄⣠⠾⠁⣀⣄⡈⠙⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀');
console.log('⠀⠀⠀⠀⢀⡀⠁⠀⠀⠈⠙⠛⠂⠈⣿⣿⣿⣿⣿⠿⡿⢿⣆⠀⠀⠀⠀⠀⠀⠀');
console.log('⠀⠀⠀⢀⡾⣁⣀⠀⠴⠂⠙⣗⡀⠀⢻⣿⣿⠭⢤⣴⣦⣤⣹⠀⠀⠀⢀⢴⣶⣆');
console.log('⠀⠀⢀⣾⣿⣿⣿⣷⣮⣽⣾⣿⣥⣴⣿⣿⡿⢂⠔⢚⡿⢿⣿⣦⣴⣾⠁⠸⣼⡿');
console.log('⠀⢀⡞⠁⠙⠻⠿⠟⠉⠀⠛⢹⣿⣿⣿⣿⣿⣌⢤⣼⣿⣾⣿⡟⠉⠀⠀⠀⠀⠀');
console.log('⠀⣾⣷⣶⠇⠀⠀⣤⣄⣀⡀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀');
console.log('⠀⠉⠈⠉⠀⠀⢦⡈⢻⣿⣿⣿⣶⣶⣶⣶⣤⣽⡹⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀');
console.log('⠀⠀⠀⠀⠀⠀⠀⠉⠲⣽⡻⢿⣿⣿⣿⣿⣿⣿⣷⣜⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀');