This file contains hidden or 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
## Static funcs to find ancestors with type queries | |
## Finds the parent of the given node whose script is a subclass of the given type. | |
static func find_parent_of(node: Node, cls: Script, depth := INT_MAX) -> Node: | |
while node and depth > 0: | |
if is_subscripted(node, cls): return node | |
node = node.get_parent() | |
depth -= 1 | |
return null | |
## As `find_parent_of` but with support for builtins. |
This file contains hidden or 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 SpriteFramesFactory | |
extends Resource | |
const suffix := ".frames.tres" | |
@export var texture: Texture2D | |
@export var tile_size:= Vector2i(16, 32) | |
@export var ul_margin := Vector2i(0, 0) |
This file contains hidden or 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
## Deque.gd: | |
## A mutatey double ended queue. | |
## They can also be pop_front or pop_backed equivalently, as well as | |
## shuffled off of a stable seed (to avoid messing with global randomizer state). | |
## Also! Supports use as a channel for fanin via the `take` operations, which are blocking. | |
class_name Deque | |
extends RefCounted | |
var front_stack:Array | |
var back_stack:Array |
This file contains hidden or 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
import Phaser from 'phaser'; | |
import dragonBones from 'dragonbones-phaser'; | |
import biped_ske_json from './biped_ske.json'; | |
import biped_tex_json from './biped_tex.json'; | |
import biped_tex_png from './biped_tex.png'; | |
export const game = new Phaser.Game({ | |
type: Phaser.WEBGL, | |
width: 400, | |
height: 300, |
This file contains hidden or 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
# Just the hack to workaround https://github.com/godotengine/godot/issues/96367 | |
func _hack_into_visibility(): | |
var vp := get_viewport() as Window | |
var orig_size := vp.size | |
print("Emulating a resize event to force the minimap to display & update around display size ", orig_size) | |
@warning_ignore("integer_division") | |
vp.size = Vector2(orig_size.x, orig_size.y / 2) | |
await RenderingServer.frame_post_draw | |
@warning_ignore("integer_division") |
This file contains hidden or 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 RayCast3D | |
## Hacks around https://github.com/godotengine/godot/issues/29727 | |
## "3D CollisionObject signals do not trigger when mouse is in "captured" mode" | |
## by having a raycast sweep for things and emulate mouse behaviors. | |
## All else equal, you'll want the configured raycast object to have: | |
## * All layers in its mask (so you can emulate the way the mouse works) | |
## * A target of `Vector3(0, 0, -4096)` (or more!) for large depth cast out of the camera. | |
## Keep a reference to this guy; it's fiesty and jumps to the currently active camera! |
This file contains hidden or 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
/*** | |
Using: | |
$ npm list phaser | |
... | |
phaser@3.50.0-beta.12 | |
... | |
I get a jserror: | |
Error: Cannot add a Scene with duplicate key: credits | |
*/ |