Skip to content

Instantly share code, notes, and snippets.

@thygrrr
thygrrr / CameraZoomAndPan.gd
Last active March 15, 2024 19:50
CameraZoomAndPan.gd - Smooth, cursor-centric 2D Zoom for Godot
# SPDX-License-Identifier: Unlicense or CC0
extends Node2D
# Smooth panning and precise zooming for Camera2D
# Usage: This script may be placed on a child node
# of a Camera2D or on a Camera2D itself.
# Suggestion: Change and/or set up the three Input Actions,
# otherwise the mouse will fall back to hard-wired mouse
# buttons and you will miss out on alternative bindings,
# deadzones, and other nice things from the project InputMap.
@rain-1
rain-1 / LLM.md
Last active May 25, 2024 23:20
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@WolfgangSenff
WolfgangSenff / gist:168cb0cbd486c8c9cd507f232165b976
Last active May 22, 2024 18:55
Godot 4.0 Migration/Upgrade guide
## For a beginner-friendly version of the following (more advanced users likely will get better use of the below,
## if you're just starting out...), see this new gist:
## https://gist.github.com/WolfgangSenff/0a9c1d800db42a9a9441b2d0288ed0fd
This document represents the beginning of an upgrade or migration document for GDScript 2.0 and Godot 4.0. I'm focusing on 2D
at the moment as I'm upgrading a 2D game, but will hopefully have more to add for 3D afterward.
## If you want more content like this, please help fund my cat's medical bills at https://ko-fi.com/kyleszklenski - thank you very much! On to the migration guide.
@jakebesworth
jakebesworth / godot-clickable-overlap.md
Last active May 4, 2024 22:06
Overlap clickable Area2D's in Godot. Only click the top most node. Also allows clicking outside of clickable nodes (such as to deselect)

Godot Clickable Overlap Objects and Deselect

Summary of Problem

If you want to have objects in your game be clickable, one of the most obvious methods is using a Area2D > Texture + CollisionShape2D. When your mouse interacts with the CollisionShape2D it has mouse motion, mouse exited, and input events.

Note: Control nodes have restrictions, eat up all mouse events, and don't work well with deselecting by clicking outside of any objects

  1. The biggest issue is when you click on overlapping objects it will signal both events asynchronously, so there is not an easy way to differentiate the top object being clicked.