Summary | How to control (or Understand) your GIST page's files list order. |
Notice | not official documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class_name ColorUtil extends Object | |
static func parse_html(rgba_or_preset: String, ignore_alpha: bool = false, default_color: Variant = null) -> Color: | |
var color: Variant = PRESET.get(rgba_or_preset.to_upper()) | |
if color == null and Color.html_is_valid(rgba_or_preset): | |
color = Color.html(rgba_or_preset) | |
if color == null: | |
return default_color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func eval(code: String) -> Error: | |
var script := GDScript.new() | |
script.source_code = "static func _static_init(): pass; " + code.strip_edges().replace("\n", ";") | |
return script.reload() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Generic wrapper for holding any value. | |
## Allows passing a value between functions by reference instead of value (copy). | |
class_name ValueHolder extends RefCounted | |
## Triggers when value is updated. Current and previous values are passed. | |
signal changed(value: Variant, last_value: Variant) | |
## Current value. Changing this value will emit changed() signal. | |
var value: Variant: | |
set(new_value): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tool | |
extends EditorScript | |
# Align selected Node2Ds to current mouse position. | |
# Ctrl+Shift+X to run. | |
func _run(): | |
var editor_interface = get_editor_interface() | |
var mouse_position = editor_interface.get_editor_viewport_2d().get_mouse_position() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Twitch Javascript injected script to simulate reward redemption. | |
// Note: Class names may need to be changed if outdated. | |
// Index of reward to click. | |
var rewardButtonIndex = 0 | |
var amountOfRedeems = 1 | |
// Class names for elements. | |
var rewardsListButtonClass = "ScCoreButton-sc-ocjdkq-0 ScCoreButtonText-sc-ocjdkq-3 ljgEdo fuXDrj" | |
var specificRewardButtonClass = "ScInteractableBase-sc-ofisyf-0 ScInteractableDefault-sc-ofisyf-1 dsnvLR etibmD tw-interactable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tool | |
extends Node2D | |
@export var show_number: bool = false: | |
set(value): | |
show_number = value | |
notify_property_list_changed() | |
@export var editable_number: bool = false: | |
set(value): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class_name SwayComponent extends Node | |
@export var sway_distance: float = 32 | |
@export var sway_duration: float = 2 | |
@onready var start_y: float = y | |
var y: float: | |
set(value): | |
var parent := get_parent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tool | |
class_name PDLine2D extends Node2D | |
@export var points: Array[Vector2i] = []: | |
set(value): | |
points = value | |
queue_redraw() | |
@export var color: Color = Color.WHITE: | |
set(value): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class_name SpacePlayer extends RigidBody2D | |
const JUMP_STRENGTH: float = 200 | |
const MOVE_SPEED: float = 200 | |
func _process(_delta: float) -> void: | |
update_input() | |
func update_input() -> void: | |
if !_is_on_ground(): |
NewerOlder