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
# ------------------------------------------------------------------------------ | |
# Running this code at the command line does not show warnings. Which I found | |
# odd. But if you make a scene and add this as the script and run it from the | |
# editor it will: | |
# Set all debug-gdscript warnings to "warn" | |
# Load all the .gd files it can find (recursively) | |
# You get all the warnings you want in the Debugger tab | |
# ------------------------------------------------------------------------------ | |
extends Node2D | |
var include_subdirectories = true |
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
[gd_scene load_steps=2 format=2] | |
[ext_resource path="res://ViewportContainer.gd" type="Script" id=1] | |
[node name="Node" type="Node"] | |
script = ExtResource( 1 ) | |
[node name="ViewportContainer" type="ViewportContainer" parent="."] | |
margin_left = 372.0 | |
margin_top = 150.0 |
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
var _script_editor = null | |
var _num_searched = 0 | |
var _text_edits = [] | |
var _focused = null | |
signal editor_changed | |
# Requires reference to the ScriptEditor instance. | |
func _init(script_edtitor): | |
_script_editor = script_edtitor |
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
# Hash containing all the built in types in Godot. This provides an English | |
# name for the types that corosponds with the type constants defined in the | |
# engine. | |
var types = {} | |
func _init_types_dictionary(): | |
types[TYPE_NIL] = 'TYPE_NIL' | |
types[TYPE_BOOL] = 'Bool' | |
types[TYPE_INT] = 'Int' | |
types[TYPE_REAL] = 'Float/Real' |
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
# ------------------------------------------------------------------------------ | |
# Usage | |
# Create a Control node in the scene you want to paint boxes for and set the | |
# script for the Control to this. | |
# | |
# Draw Stoppers, Ignores, Passsers: | |
# When enabled these options will draw rectangles for any object that contains | |
# the mouse when you click. Stoppers, Ignores, Passers refers to the | |
# value of mouse_filter. | |
# |
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
extends SceneTreee | |
const SERVER_NODE_PATH := "res://content/scripts/server/server.gd"; | |
# Create and return a server node | |
func create_server(): | |
# Load relevant server files | |
var server_script := load(SERVER_NODE_PATH) | |
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
# ------------------------------------------------------------------------------ | |
# iOS app store has a queue of events. Whenever a method that would expect an | |
# event to show up in this queue the queue_monitor is (re)started and | |
# will run for _max_wait seconds. The monitor will call the corrosponding event | |
# handler for any events it finds while running. When _max_wait seconds have | |
# elapsed then statuses are checked to see if anything is waiting on a response. | |
# If any are found then the status is changed to ERROR. | |
# | |
# There is some room for improvement here, but it seems to be working pretty | |
# well. There's a lot of edge cases to worry about but I haven't thought of |
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
# This tests sets a car object and a checkpoint object (created in before_each) | |
# on a collision path and waits 1 second for the collision to occur. It then | |
# checks a property in the checkpoint to verify the collision happened. | |
func test_crosses_when_target_car_crosses(): | |
gr.checkpoint.set_position(Vector2(500, 0)) | |
var car = _g.r.TargetCarScene.instance() | |
car.set_global_position(Vector2(400, 300)) | |
add_child(car) | |
car.set_speed(200, 0) |
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
extends 'res://addons/gut/test.gd' | |
var BigSpinner = load('res://<your spinner scene path>') | |
func test_can_make_one(): | |
assert_not_null(BigSpinner.instance()) | |
func test_get_set_low(): | |
assert_accessors(BigSpinner.instance(), 'low', 0.0, 10.0) |
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
# Hook this up to a label and two buttons. The label must be named "Value" | |
# or you can change the code. | |
extends Control | |
export var _low = 0.0 setget set_low, get_low | |
export var _high = 100.0 setget set_high, get_high | |
export var _step = 1.0 setget set_step, get_step | |
export var _value = 0.0 setget set_value, get_value | |
signal value_changed |
NewerOlder