Skip to content

Instantly share code, notes, and snippets.

@Pizzaandy
Pizzaandy / CameraZoomAndPan.gd
Created October 19, 2024 00:27
Simple Zoom + Pan Camera
extends Camera2D
@export_range(1, 20, 0.01) var maxZoom : float = 10.0
@export_range(0.01, 1, 0.01) var minZoom : float = 0.1
@export_range(0.01, 0.2, 0.01) var zoomStepRatio : float = 0.1
@onready var zoom_scale: float = clamp(zoom.x, minZoom, maxZoom)
func _input(event: InputEvent) -> void:
if Input.is_mouse_button_pressed(MOUSE_BUTTON_MIDDLE) or Input.is_mouse_button_pressed(MOUSE_BUTTON_RIGHT):
Shader "Hidden/JumpFloodOutline"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "PreviewType" = "Plane" }
Cull Off ZWrite Off ZTest Always
@Pizzaandy
Pizzaandy / AdvancedCharacterBody2D.cs
Created December 24, 2023 05:38
Godot CharacterBody2D implemented in C#
using Godot;
using System.Collections.Generic;
public enum MovementMode
{
Grounded,
Floating,
}
public partial class AdvancedCharacterBody2D : AnimatableBody2D
@Pizzaandy
Pizzaandy / StackFrameLogger.cs
Created April 24, 2023 06:24
Simple Unity stack frame logging
using UnityEngine;
using System;
using System.Text;
using System.Diagnostics;
using Debug = UnityEngine.Debug;
public static class StackFrameUtility
{
public static void Log(this StackFrame frame, object message = null)
{