Skip to content

Instantly share code, notes, and snippets.

View codevogel's full-sized avatar

Kamiel de Visser codevogel

View GitHub Profile
@codevogel
codevogel / usage_example.gd
Last active September 8, 2025 13:16
Godot type validation for a PackedScene. (Generate configuration warnings when referring to a scene that doesn't have the expected script attached). See below for more context.
@tool
extends Node3D
class_name UsageExample
@export var _my_scene: PackedScene
func _get_configuration_warnings() -> PackedStringArray:
var warnings: PackedStringArray = []
if not _my_scene:
warnings.append("My Scene is not assigned.")
@codevogel
codevogel / arrow_map.gd
Last active August 3, 2024 12:44
Example code for drawing arrows on a tilemap. Is missing layering.
class_name ArrowMap
extends TileMap
enum Direction { NONE = 0, NORTH = 1, EAST = 2, SOUTH = 4, WEST = 8, ALL = 15 }
const DIRECTION_MAP = {
Vector2i(1, 0): Direction.EAST,
Vector2i(-1, 0): Direction.WEST,
Vector2i(0, -1): Direction.NORTH,
Vector2i(0, 1): Direction.SOUTH
}