Skip to content

Instantly share code, notes, and snippets.

View Sciman101's full-sized avatar

Sciman101

View GitHub Profile
@noidexe
noidexe / RoundRobinPlayer.gd
Created September 9, 2019 07:00
RoundRobinPlayer node for Godot Engine with sequence, random, and shuffle modes extending AudioStreamPlayer
tool
extends AudioStreamPlayer #exactly the same code should work for extending 2D and 3D versions
class_name RoundRobinPlayer
export(int, "sequence", "random", "shuffle") var queue_mode = 0
export(Array, AudioStream) var playlist = [] setget _set_playlist, _get_playlist
export(bool) var round_robin_playing = false setget _set_playing, _is_playing # can't override properties so use this for animations
var playlist_index = -1 # current position in the playlist
var shuffled_indices = [] # Array<int> of shuffled playlist indices
@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:
#
@Sciman101
Sciman101 / player.gd
Last active January 21, 2021 00:27
Godot Platformer Starter Code
extends KinematicBody2D
const ACC_INSTANT = 1000000 # If acceleration time is 0, default to this
# Exposed movement parameters
export var move_speed : float
export var acceleration_time : float # How many seconds does it take to go from 0 to max speed?
export var air_acceleration_time : float # How many seconds does it take to go from 0 to max speed, when we're midair?
export var friction_time : float # How many seconds does it take to go from max speed to 0?
export var jump_height : float # How many pixels vertically should we jump