Skip to content

Instantly share code, notes, and snippets.

@CowThing
CowThing / random.gd
Last active March 6, 2021 23:04
Random number generator class for Godot 3.2
extends Reference
class_name Random
"""
A self contained random number generator class. Use this for non-global random number generation.
Create the class using `Random.new()`, optionally input a seed directly while creating.
Notes
----
You only need to call `randomize_seed()` once to make the seed random.
@CowThing
CowThing / pixel_perfect.gd
Last active April 6, 2024 17:09
Pixel perfect scaling script for Godot 3.1
extends Node
"""
An autoload singleton for pixel perfect rendering of the game.
Set this script as an autoload.
`base_size` - Is the target size of the viewport. The viewport will scale up to fit the largest
possible integer multiple of this size within the window.
`expand` - If true the viewport will expand to the edges of the window after scaling up.