Skip to content

Instantly share code, notes, and snippets.

View NovemberDev's full-sized avatar
🌊
somewhere out there

NovemberDev

🌊
somewhere out there
View GitHub Profile
@NovemberDev
NovemberDev / godot_finite_state_machine.gd
Last active October 5, 2021 12:09
Godot Finite state machine script / class in one file
# godot_finite_state_machine.gd
# by: @november_dev
#
# The finite state machine takes in a number of states and transitions.
#
# A state can contain a function that will be executed or looped while the state is active.
#
# The transition gets a function that returns a boolean truthiness value, which determines
# if the transition should happen or not.
#
# godot_command_line.gd
# by: @november_dev
#
# Parse command line arguments in an exported project
#
# Command:
# /path/to/executable "res://scene.tscn" first_value=value second_value=value
#
# Sample:
#
#
# Author: @November_Dev
#
# This class is a straightforward, zero overhead implementation of
# very basic FPS controls.
#
# Ideal node setup:
# KinematicBody
# |- Camera
#
extends Node
var API = "http://localhost:5000/api"
var current_request = {}
var request_queue = []
var is_busy = false
var http
func _ready():
http = HTTPRequest.new()
@NovemberDev
NovemberDev / BehaviourTree.cs
Last active March 11, 2021 10:37
C# Behaviour Tree
using System;
using System.Linq;
using System.Collections.Generic;
public enum BehaviourTreeState
{
Success,
Failure,
Running
}
@NovemberDev
NovemberDev / godot_curvature_shader.glsl
Last active December 16, 2019 11:30
A shader that adds curvature to meshes in godot
/*
Adds curvature to any mesh.
Author: @November_Dev
*/
shader_type spatial;
@NovemberDev
NovemberDev / godot_async_scene_loader.gd
Last active February 10, 2024 22:57
Asynchronously loads scenes in godot
# Loads a scene in the background using a seperate thread and a queue.
# Foreach new scene there will be an instance of ResourceInteractiveLoader
# that will raise an on_scene_loaded event once the scene has been loaded.
# Hooking the on_progress event will give you the current progress of any
# scene that is being processed in realtime. The loader also uses caching
# to avoid duplicate loading of scenes and it will prevent loading the
# same scene multiple times concurrently.
#
# Sample usage:
#
public static bool IsEven(int i) {
return (i & 1) == 0;
}
/*
Returns if the given integer is even using Bitwise & AND operator:
1010 equals 10 in decimal
0001 equals 1 in decimal
0000 AND returns 0 so it is even (0 of 10, 1 of 1)
extends KinematicBody2D
const HALT_SPEED = 0.325
const MAX_SPEED = 750.0
const GRAVITY = 1200.0
const MAX_JUMP = 725.0
const MAX_JUMP_TIME = 1.5
const MAX_JUMP_FORGIVENESS_TIME = 0.5
@NovemberDev
NovemberDev / GenericBinaryTree.cs
Last active March 22, 2021 10:31
Generic Binary Tree implementation I built
using System;
using System.Collections.Generic;
// Author: NovemberDev
public class Program
{
///
/// TreeNode baseclass
///